Ejemplo n.º 1
0
from sklearn.pipeline import Pipeline
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelEncoder
from sklearn.model_selection import GridSearchCV, KFold, cross_val_predict, cross_val_score, StratifiedKFold
from sklearn.feature_selection import SelectKBest, SelectPercentile
from sklearn.feature_selection import f_classif, mutual_info_classif
from sklearn.compose import TransformedTargetRegressor
import load_data_ST
import save_output
import GSCV

name_clf = 'SVMR_linear_STDS'

#load data

data_train, labels_train, data_test, labels_test = load_data_ST.function_load_data_ST(
)

#Scalers
from sklearn.preprocessing import StandardScaler, RobustScaler, MinMaxScaler

scalers_to_test = [StandardScaler(), RobustScaler(), MinMaxScaler()]

df = pd.DataFrame()

#Designate distributions to sample hyperparameters from
C_range = np.power(2, np.arange(-10, 8, dtype=float))
n_features_to_test = [0.85, 0.9, 0.95]

clf = TransformedTargetRegressor(regressor=SVR(kernel='linear'),
                                 transformer=MinMaxScaler())
Ejemplo n.º 2
0
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelEncoder
from sklearn.model_selection import GridSearchCV
from sklearn.model_selection import RandomizedSearchCV
from sklearn.ensemble import RandomForestClassifier
from sklearn.compose import TransformedTargetRegressor
from sklearn.linear_model import LinearRegression
import load_data_ST
import save_output
import nested_cv_ST

name_clf = 'LinearRegression'

#load data

data, labels = load_data_ST.function_load_data_ST()

#Scalers

from sklearn.preprocessing import StandardScaler, RobustScaler, MinMaxScaler
scalers_to_test = [StandardScaler(), RobustScaler(), MinMaxScaler(), None]

df = pd.DataFrame()

# Designate distributions to sample hyperparameters from
n_features_to_test = [0.85, 0.9, 0.95]

clf = TransformedTargetRegressor(regressor=LinearRegression(),
                                 transformer=MinMaxScaler())

#LinearRegression
Ejemplo n.º 3
0
from sklearn.ensemble import RandomForestRegressor
from sklearn.preprocessing import StandardScaler, RobustScaler, MinMaxScaler
from sklearn.linear_model import LinearRegression
from sklearn.svm import SVR

import load_data_ST
import os

regr_RF_name = 'RandomForestRegressor'
regr_svml_name = 'SVR linear'
regr_rbf_name = 'SVR rbf'
regr_sig_name = 'SVR sigmoid'

#load data

pu_data, pu_labels, pa_data, pa_labels = load_data_ST.function_load_data_ST()

regr_RF = RandomForestRegressor(n_estimators=100,
                                max_depth=10,
                                criterion='mae',
                                random_state=503)

regr_svml = LinearRegression()

regr_rbf = SVR(kernel='rbf', C=0.25, gamma=0.0078125)

regr_sig = SVR(kernel='sigmoid', C=0.0625, gamma=125)

clf_RF = TransformedTargetRegressor(regressor=regr_RF,
                                    transformer=MinMaxScaler())
Ejemplo n.º 4
0
from sklearn.compose import TransformedTargetRegressor
from sklearn.ensemble import RandomForestRegressor
from sklearn.preprocessing import StandardScaler, RobustScaler, MinMaxScaler
from sklearn.preprocessing import LabelEncoder
from sklearn.metrics import roc_auc_score, classification_report, accuracy_score, balanced_accuracy_score
import seaborn as sns

import load_data_ST
import os

name_clf = 'RandomForestRegressor'


#load data

pu_data, pu_labels, PA_data, PA_labels = load_data_ST.function_load_data_ST()


# Designate distributions to sample hyperparameters from 
n_features_to_test = [0.85, 0.9, 0.95]
n_tree = [15, 30, 45, 60, 75, 90, 105, 120, 135, 150, 165, 180]
depth = [ 2, 5, 10, 15, 20, 30, 45, 60, 75]



regr_RF = RandomForestRegressor(criterion='mae', random_state=503)

pca = PCA(random_state=42, n_components=0.85)

#clf