Exemple #1
0
 def loadData(self):
     l = LoadData()
     data_cluster = l.loadData('wine-clustering.csv')
     self.std_scaler = StandardScaler()
     self.min_max_scaler = MinMaxScaler()
     data_cluster[data_cluster.columns] = self.std_scaler.fit_transform(
         data_cluster)
     data_cluster[data_cluster.columns] = self.min_max_scaler.fit_transform(
         data_cluster)
     # print(data_cluster.mean())
     # data = data_cluster.to_numpy()
     # np.savetxt('data.txt', data, fmt='%.1f')
     # coverience_matrix = np.dot(np.transpose(data),
     #                            data) / (data.shape[1] - 1)
     # np.savetxt('matrix.txt', coverience_matrix, fmt='%.1f')
     # pca
     self.pca_2 = PCA(2)
     self.pca_2_result = self.pca_2.fit_transform(data_cluster)
     self.data = data_cluster
Exemple #2
0
 def loadData(self, filename):
     l = LoadData()
     self.data = l.loadData(filename)
Exemple #3
0
# encoding=utf-8
'''
Created on 2018年1月6日

@author: yufangzheng
'''
from LoadData import  LoadData;
from Model import SVD;

if __name__ == "__main__":
    feature = 100
    steps = 30   
    alpha = 0.009
    lambda1 = 0.01
    ld = LoadData()
    filename_train = '/home/zwp/work/Dataset/ws/train/sparseness5/training1.txt' 
    filename_test = '/home/zwp/work/Dataset/ws/test/sparseness5/test1.txt';
    train, test = ld.loadData(filename_train, filename_test)
    model = SVD(train,test,feature,steps,alpha,lambda1)
    model.initialParameter()
    model.learnMF()
    MAE,RMSE = model.calMAEAndRMSE()
    print (MAE,RMSE)
Exemple #4
0
 def loadData(self, train_size):
     l = LoadData()
     self.data = l.loadData(train_size)