def build_model(self,train_set): i_model = None if self.friends_data: i_model = FriendsModel(train_set, self.friends_data) else: i_model = Model(train_set) return i_model
def create_model(): raw_data = get_user_item_matrix() friend_data = get_friends_data() i_model = FriendsModel(raw_data, friend_data) return i_model
def get_similarity_matrix(data_set, friend_data): i_model = FriendsModel(data_set, friend_data) similarity = CosineSimilarity(i_model) return similarity
def build_model(self,train_set): i_model = FriendsModel(train_set, self.friends_data) return i_model
import sys sys.path.append("./src") from similarities import CosineSimilarity, JaccardSimilarity from dataset import get_friends_data, get_user_item_matrix from models.friendsmodel import FriendsModel #import matplotlib.pyplot as plt from pylab import * if __name__ == '__main__': raw_data = get_user_item_matrix() friend_data = get_friends_data() i_model = FriendsModel(raw_data, friend_data) data = i_model.get_data_matrix() figure(1) imshow(data,interpolation='bilinear') grid(True) show()
import sys sys.path.append("./src") from similarities import CosineSimilarity, JaccardSimilarity from dataset import get_friends_data, get_user_item_matrix from models.friendsmodel import FriendsModel #import matplotlib.pyplot as plt from pylab import * if __name__ == '__main__': raw_data = get_user_item_matrix() friend_data = get_friends_data() i_model = FriendsModel(raw_data, friend_data) data = i_model.get_data_matrix() figure(1) imshow(data, interpolation='bilinear') grid(True) show()