This file contains 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
import pandas as pd | |
pd.set_option('display.max_columns', 18) | |
data = pd.read_csv('../datasets/athlete_events.csv') | |
dt = data.dropna() | |
print("Full sample: {0}".format(data.shape)) | |
print("Sample without NaN: {0}".format(dt.shape)) |
This file contains 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
import pandas as pd | |
pd.set_option('display.max_columns', 18) | |
data = pd.read_csv('../datasets/athlete_events.csv') | |
dt = data.dropna() | |
print(dt.head()) |
This file contains 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
import pandas as pd | |
pd.set_option('display.max_columns', 18) | |
data = pd.read_csv('../datasets/athlete_events.csv') | |
print(data.head()) | |
print(data.dtypes) |
This file contains 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
import pandas as pd | |
pd.set_option('display.max_columns', 42) | |
data = pd.read_csv('../datasets/2015-building-energy-benchmarking.csv') | |
data['DataYear'] = data['DataYear'].astype(object) | |
print(data.dtypes) |
This file contains 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
import pandas as pd | |
pd.set_option('display.max_columns', 42) | |
data = pd.read_csv('../datasets/2015-building-energy-benchmarking.csv') | |
print(data.dtypes) |
This file contains 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
import pandas as pd | |
pd.set_option('display.max_columns', 42) | |
data = pd.read_csv('../datasets/2015-building-energy-benchmarking.csv') | |
print(data.head()) |
This file contains 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 | |
diameterPassed = float(input("What's the diameter(cm) of the pizza you want? ")) | |
diameters = [[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() |
This file contains 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() |
This file contains 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 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__': |