tzhangwps / Recession-Predictor

Project description: https://medium.com/p/recession-prediction-using-machine-learning-de6eee16ca94?source=email-2adc3d3cd2ed--writer.postDistributed&sk=2f1dab9738769f9658634e61576a08bd
MIT License
30 stars 28 forks source link

Parallel SVM training #23

Closed fatalfeel closed 2 months ago

fatalfeel commented 2 months ago

could modified as

svm = OneVsRestClassifier(SVC(C=C, kernel='rbf', gamma=gamma, probability=True, tol=1e-4, random_state=123, class_weight='balanced'), n_jobs=-1) svm.fit(X=training_x_scaled, y=self.training_y)

                #svm_count = len(svm.support_) / len(training_x_scaled)
                supportcounts = 0
                for estimator in svm.estimators_:
                    supportcounts += len(estimator.support_)
                svm_count = supportcounts / len(training_x_scaled)

and

svm = OneVsRestClassifier(SVC(C=self.optimal_C, kernel='rbf', gamma=self.optimal_gamma, probability=True, tol=1e-4, random_state=123, class_weight='balanced'), n_jobs=-1) svm.fit(X=training_x_scaled, y=self.training_y)

    #self.support_vector_count_as_percent = len(svm.support_) / len(training_x_scaled)
    supportcounts = 0
    for estimator in svm.estimators_:
        supportcounts += len(estimator.support_)
    self.support_vector_count_as_percent = supportcounts / len(training_x_scaled)                    
fatalfeel commented 2 months ago

after try OneVsRestClassifier i feel not faster than single svm so please close this issue