Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Data
- dataset = pd.read_csv('Social_Network_Ads.csv')
- X = dataset.iloc[:, [2, 3]].values
- y = dataset.iloc[:, 4].values
- # Scaling
- from sklearn.preprocessing import StandardScaler
- sc = StandardScaler()
- X = sc.fit_transform(X)
- # SVM
- from sklearn.svm import SVC
- classifier = SVC(kernel='rbf', random_state=0)
- # Grid Search with Cross Validation (Params Optimization)
- from sklearn.model_selection import GridSearchCV
- p = [{'C': [1, 2, 3, 4, 5], 'Kernel':['linear']},
- {'C': [1, 10, 100, 1000], 'kernel': ['rbf'],
- 'gamma': [1, 0.5, 0.1, 0.01, 0.001]}]
- gs = GridSearchCV(estimator=classifier, param_grid=p,
- scoring='accuracy', cv=10, n_jobs=-1)
- grid_search = gs.fit(X, y)
- bestScore = grid_search.best_score_
- bestParams = grid_search.best_params_
- print(bestScore, bestParams)
- Traceback (most recent call last):
- File "C:UsersuserPycharmProjectsMachineLearningvenvlibsite-
- packagessklearnexternalsjoblibexternalslokyprocess_executor.py", line
- 391, in _process_worker
- call_item = call_queue.get(block=True, timeout=timeout)
- File
- C:UsersuserAppDataLocalProgramsPythonPython37lib
- multiprocessingqueue
- s.py", line 99, in get
- if not self._rlock.acquire(block, timeout):
- PermissionError: [WinError 5] Eriลim engellendi
Add Comment
Please, Sign In to add comment