print "reduced_feature_matrix_logistic before transpose:%d" % len(reduced_feature_matrix_logistic) reduced_feature_matrix_logistic = zip(*reduced_feature_matrix_logistic) print "reduced_feature_matrix_logistic after transpose:%d" % len(reduced_feature_matrix_logistic) coef_path_linear_cv.fit(reduced_feature_matrix_logistic,y) linear_cv_score = cross_validation.cross_val_score(coef_path_linear_cv, reduced_feature_matrix_logistic, y, n_jobs=2, cv=CV, scoring=Scoring) linear_results_parameters = [ coef_path_linear_cv.predict(reduced_feature_matrix_logistic), coef_path_linear_cv.get_params,reduced_feature_list_logistic, coef_path_linear_cv.coef_] linear_scores = [linear_cv_score, r2_score(y, linear_results_parameters[0]), 'linear'] print "reduced_feature_list_logistic length:%d" % len(reduced_feature_list_logistic) print "linear_coefficient length:%d" % len(coef_path_linear_cv.coef_) linear_word_results = [] ###LINEAR REGRESSION END for i in range(len(coef_path_linear_cv.coef_)): temp_list = [reduced_feature_list_logistic[i], coef_path_linear_cv.coef_[i]] linear_word_results.append(temp_list) #word_priority_linear = sorted (linear_word_results, key= lambda x: float(x[1]), reverse=True) model_results = [forest_results_parameters, lasso_results_parameters, elastic_results_parameters, logistic_results_parameters, binary_x_logistic_results_parameters, linear_results_parameters] model_scores = [forest_scores, lasso_scores, elastic_scores, logistic_scores, binary_x_logistic_scores, linear_scores] post_processing(model_results, model_scores, X, y, widget_selection, list_of_features, Ngram_Range_Low, Ngram_Range_High)
reduced_feature_matrix_logistic = zip(*reduced_feature_matrix_logistic) print "reduced_feature_matrix_logistic after transpose:%d" % len(reduced_feature_matrix_logistic) coef_path_linear_cv.fit(reduced_feature_matrix_logistic,y) linear_cv_score = cross_validation.cross_val_score(coef_path_linear_cv, reduced_feature_matrix_logistic, y, n_jobs=2, cv=CV, scoring=Scoring) linear_results_parameters = [ coef_path_linear_cv.predict(reduced_feature_matrix_logistic), coef_path_linear_cv.get_params,reduced_feature_list_logistic, coef_path_linear_cv.coef_] linear_scores = [linear_cv_score, r2_score(y, linear_results_parameters[0]), 'linear'] print "reduced_feature_list_logistic length:%d" % len(reduced_feature_list_logistic) print "linear_coefficient length:%d" % len(coef_path_linear_cv.coef_) linear_word_results = [] ###LINEAR REGRESSION END for i in range(len(coef_path_linear_cv.coef_)): temp_list = [reduced_feature_list_logistic[i], coef_path_linear_cv.coef_[i]] linear_word_results.append(temp_list) #model_results = [forest_results_parameters, lasso_results_parameters, elastic_results_parameters, logistic_results_parameters, 0, linear_results_parameters] #model_scores = [forest_scores, lasso_scores, elastic_scores, logistic_scores, 0, linear_scores] model_results = [forest_results_parameters, 0, 0, logistic_results_parameters, 0, linear_results_parameters] model_scores = [forest_scores, 0, 0, logistic_scores, 0, linear_scores] post_processing(model_results, model_scores, X, y, widget_selection, list_of_features, Ngram_Range_Low, Ngram_Range_High, Min_DF, PageLoaded, WidgetViewed, ite)