12345678910111213141516171819202122232425262728293031323334 |
- #!/usr/bin/env python3
- # -*- coding: utf-8 -*-
- """
- Created on Mon Oct 5 09:50:24 2020
- @author: tanya
- """
- from sklearn.ensemble import RandomForestClassifier
- from sklearn.feature_selection import SelectPercentile
- from sklearn.linear_model import LogisticRegression
- from sklearn.decomposition import PCA
- from sklearn.pipeline import Pipeline
- from sklearn.preprocessing import StandardScaler
- space = [
- {"name": "std_scaler_kbest_rf",
- "pipeline": Pipeline([
- ("std_scaler", StandardScaler()),
- ("kbest", SelectPercentile()),
- ("rf", RandomForestClassifier())]),
- "params": {"kbest__percentile": [2, 3],
- "rf__n_estimators": [10, 20]}},
- {"name": "std_scaler_pca_lr",
- "pipeline": Pipeline([
- ("std_scaler", StandardScaler()),
- ("pca", PCA()),
- ("lr", LogisticRegression())]),
- "params": {"lr__C": [0.5, 1],
- "pca__n_components": [2, 3]}}
- ]
|