def train(train_data_dir, labels, sample_num): f_index, y, X = FeatureFactor.getFeatureSpace(train_data_dir, labels, sample_num) saveTheFSpace(f_index) model = Libsvm.train(y, X) Libsvm.saveModel(model)
def train( train_data_dir, labels, sample_num ): f_index, y, X = FeatureFactor.getFeatureSpace( train_data_dir, labels, sample_num ) saveTheFSpace( f_index ) model = Libsvm.train( y, X ) Libsvm.saveModel( model )
def recommend(allWeibos): model = Libsvm.loadModel() f_index = loadTheFSpace() f_vector = FeatureFactor.getFeature(allWeibos, f_index) label = Libsvm.predict(f_vector, model) return label
def recommend( allWeibos ): model = Libsvm.loadModel() f_index = loadTheFSpace() f_vector = FeatureFactor.getFeature( allWeibos, f_index ) label = Libsvm.predict( f_vector, model ) return label