Skip to content

Instantly share code, notes, and snippets.

@SajidLhessani
Last active October 7, 2021 04:22
Show Gist options
  • Save SajidLhessani/5ae7bfcf315f3d5bae086ddab07c987e to your computer and use it in GitHub Desktop.
Save SajidLhessani/5ae7bfcf315f3d5bae086ddab07c987e to your computer and use it in GitHub Desktop.
# Test variables for 'c' and 'g'
#Setting the different values to test within C, Gamma and Kernel
c = [10, 100, 1000, 10000]
g = [1e-2, 1e-1, 1e0]
# Intialise the parameters
parameters = {'svc__C': c,
'svc__gamma': g,
'svc__kernel': ['rbf']
}
#Creating the step by step pipeline
# Create the 'steps' variable with the pipeline functions
steps = [('scaler', StandardScaler()), ('svc', SVC())]
# Pass the 'steps' to the Pipeline function
pipeline = Pipeline(steps)
#Creating a randomized function to help to find the best parameters.
# Call the RandomizedSearchCV function and pass the parameters
rcv = RandomizedSearchCV(pipeline, parameters, cv=TimeSeriesSplit(n_splits=2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment