This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from matplotlib import pyplot as plt | |
| import pandas as pd | |
| df = pd.DataFrame( | |
| { | |
| 'Grade':[50, 50, 46, 95, 50, 5, 57, 42, 26, 72, 78, 60, 40, 17, 85], | |
| 'Salary':[50000, 54000, 50000, 189000, 55000, 40000, 59000, 42000, 47000, 78000, 119000, 95000, 49000, 29000, 130000] | |
| } | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from matplotlib import pyplot as plt | |
| import pandas as pd | |
| df = pd.DataFrame( | |
| { | |
| 'Grade':[50, 50, 46, 95, 50, 5, 57, 42, 26, 72, 78, 60, 40, 17, 85], | |
| 'Salary':[50000, 54000, 50000, 189000, 55000, 40000, 59000, 42000, 47000, 78000, 119000, 95000, 49000, 29000, 130000] | |
| } | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from matplotlib import pyplot as plt | |
| import pandas as pd | |
| df = pd.DataFrame( | |
| { | |
| 'Grade':[50, 50, 46, 95, 50, 5, 57, 42, 26, 72, 78, 60, 40, 17, 85], | |
| 'Salary':[50000, 54000, 50000, 189000, 55000, 40000, 59000, 42000, 47000, 78000, 119000, 95000, 49000, 29000, 130000] | |
| } | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def checkVersion(): | |
| import sklearn | |
| print('Scikit-Learn Version: {0}'.format(sklearn.__version__)) | |
| if __name__ =='__main__': | |
| checkVersion() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def createRegression(samples, variavel_numbers, n_noise): | |
| from sklearn.datasets import make_regression | |
| x, y = make_regression(n_samples=samples, n_features=variavel_numbers, noise=n_noise) | |
| return x, y | |
| if __name__ =='__main__': | |
| from matplotlib import pyplot as plt | |
| reg = createRegression(200, 1, 30) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def createRegression(samples, variavel_numbers, n_noise): | |
| from sklearn.datasets import make_regression | |
| x, y = make_regression(n_samples=samples, n_features=variavel_numbers, noise=n_noise) | |
| return x, y | |
| if __name__ =='__main__': | |
| from sklearn.linear_model import LinearRegression | |
| from matplotlib import pyplot as plt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def createRegression(samples,variavel_numbers, n_noise): | |
| from sklearn.datasets import make_regression | |
| x, y = make_regression(n_samples=samples, n_features=variavel_numbers, noise=n_noise) | |
| return x, y | |
| if __name__ =='__main__': | |
| from sklearn.linear_model import LinearRegression | |
| from sklearn.model_selection import train_test_split | |
| from matplotlib import pyplot as plt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| R-Squared or Coefficient of Determination | |
| """ | |
| def createRegression(samples,variavel_numbers, n_noise): | |
| from sklearn.datasets import make_regression | |
| x, y = make_regression(n_samples=samples, n_features=variavel_numbers, noise=n_noise) | |
| return x, y | |
| if __name__ =='__main__': |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from sklearn.model_selection import train_test_split | |
| from sklearn.linear_model import LinearRegression | |
| from matplotlib import pyplot as plt | |
| import pandas as pd | |
| pd.set_option('display.max_columns', 21) | |
| df = pd.read_csv('../datasets/kc_house_data.csv') | |
| df = df.drop(['id', 'date', 'zipcode', 'lat', 'long'], axis=1) | |
| y = df['price'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from sklearn.model_selection import train_test_split | |
| from sklearn.linear_model import LinearRegression | |
| from matplotlib import pyplot as plt | |
| diameter = [[7], [10], [15], [30], [45], [13], [60], [100], [5], [30], [90], [18], [70], [110], [25]] | |
| prices = [[8], [11], [16], [38.5], [52], [14], [70], [90], [6], [38.5], [102], [20], [85], [100], [34]] | |
| model = LinearRegression() |