(self, X, Y)
Train model. The result is saved into self.clf
Train model. The result is saved into self.clf
Train model . The result is saved into self . clf
def train(self, X, Y):
        ''' Train model. The result is saved into self.clf '''
        n_components = min(NUM_FEATURES_FROM_PCA, X.shape[1])
        self.pca = PCA(n_components=n_components, whiten=True)
        self.pca.fit(X)
        # print("Sum eig values:", np.sum(self.pca.singular_values_))
        print("Sum eig values:", np.sum(self.pca.explained_variance_ratio_))
        X_new = self.pca.transform(X)
        print("After PCA, X.shape = ", X_new.shape)
        self.clf.fit(X_new, Y)
def train ( self , X , Y ) : n_components = min ( NUM_FEATURES_FROM_PCA , X . shape [ 1 ] ) self . pca = PCA ( n_components = n_components , whiten = True ) self . pca . fit ( X ) # print("Sum eig values:", np.sum(self.pca.singular_values_)) print ( "Sum eig values:" , np . sum ( self . pca . explained_variance_ratio_ ) ) X_new = self . pca . transform ( X ) print ( "After PCA, X.shape = " , X_new . shape ) self . clf . fit ( X_new , Y )