from sklearn.model_selection import GridSearchCV from sklearn.model_selection import RandomizedSearchCV import load_data import save_output import nested_cv name_1 = 'svm_lin_MMS' name_2 = 'svm_lin_RBTS' name_3 = 'svm_lin_STDS' dim_reduction = 'PCA' #load data public_data, public_labels = load_data.function_load_data() #Scalers from sklearn.preprocessing import StandardScaler, RobustScaler, MinMaxScaler scalers_to_test = [RobustScaler(), MinMaxScaler()] #Designate distributions to sample hyperparameters from C_range = np.power(2, np.arange(-10, 11, dtype=float)) n_features_to_test = [0.85, 0.9, 0.95] #SVM steps = [('scaler', MinMaxScaler()), ('red_dim', PCA()), ('clf', SVC(kernel='linear', probability=True, random_state=503))] pipeline = Pipeline(steps)
from sklearn.compose import TransformedTargetRegressor from sklearn.linear_model import LinearRegression 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 from sklearn.model_selection import learning_curve import plot_learning_curve import load_data import os name_clf = 'LinearRegression' #load data data, labels = load_data.function_load_data() outer_kf = KFold(n_splits=5, shuffle=True, random_state=2) #clf pca = PCA(random_state=42) regr_svml = LinearRegression() clf = TransformedTargetRegressor(regressor=regr_svml, transformer=MinMaxScaler()) steps = [('scaler', StandardScaler()), ('red_dim', None), ('clf', clf)] pipeline = Pipeline(steps)