<jupyter_start><jupyter_text>Support Vector Regression (SVR)  Importing the libraries<jupyter_code>import numpy as np
import matplotlib.pyplot as plt
import pandas as pd<jupyter_output><empty_output><jupyter_text>Importing the dataset<jupyter_code>dataset = pd.read_csv('Position_Salaries.csv')
X = dataset.iloc[:, 1:-1].values
y = dataset.iloc[:, -1].values
y = y.reshape(len(y),1)
print(X)
print(y)<jupyter_output>[[ 1]
 [ 2]
 [ 3]
 [ 4]
 [ 5]
 [ 6]
 [ 7]
 [ 8]
 [ 9]
 [10]]
[[  45000]
 [  50000]
 [  60000]
 [  80000]
 [ 110000]
 [ 150000]
 [ 200000]
 [ 300000]
 [ 500000]
 [1000000]]<jupyter_text>Feature Scaling<jupyter_code>from sklearn.preprocessing import StandardScaler
sc_X = StandardScaler()
sc_y = StandardScaler()
X = sc_X.fit_transform(X)
y = sc_y.fit_transform(y)<jupyter_output><empty_output><jupyter_text>Training the SVR model on the whole dataset<jupyter_code>from sklearn.svm import SVR
 regressor = SVR(kernel = 'rbf')
 regressor.fit(X,y)<jupyter_output>/usr/local/lib/python3.6/dist-packages/sklearn/utils/validation.py:760: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().
  y = column_or_1d(y, warn=True)<jupyter_text>Predicting a new result<jupyter_code>sc_y.inverse_transform(regressor.predict(sc_X.transform([[6.5]])))<jupyter_output><empty_output><jupyter_text>Visualising the SVR results<jupyter_code>plt.scatter(sc_X.inverse_transform(X),sc_y.inverse_transform(y), color = 'red')
plt.plot(sc_X.inverse_transform(X),sc_y.inverse_transform(regressor.predict(X)), color = 'blue')
plt.title('Support Vector Regression)')
plt.xlabel('Position level')
plt.ylabel('Salary')
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14009111617312073, 'fraction_numerical': 0.04612756264236902, 'mean_word_length': 6.444915254237288, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '474583', 'license': 'CC0-1.0', 'n_tokens_mistral': 749, 'n_tokens_neox': 682, 'n_words': 122, 'path': 'SupportVectorRegression.ipynb', 'repo_name': 'vishnu98n/prokchops', 'size': '1756'}