<jupyter_start><jupyter_text>Scikit-Learn Basicshttps://scikit-learn.org/stable/ Tutorial and nice resourceshttps://scikit-learn.org/stable/tutorial/index.htmlhttps://stackoverflow.com/ Nice sources for Datasetshttps://archive.ics.uci.edu/ml/index.php (datasets, datasets, all kinds of datasets)https://www.kaggle.com/ (earn some money while challenging your skill?)https://www.google.com/  Quick Review Types of machine learning problems?* Supervised Learning - Classification - Regression* Unsupervised Learning - Clustering - Dimension Reduction - Density Estimation Types of data?* Categorical - Nominal - Ordinal* Numerical - Discrete - Continuous<jupyter_code># Loading model
from sklearn import some_model

# Initalize model
model =<jupyter_output><empty_output><jupyter_text>Challenge!This dataset contains house sale prices for King County, which includes Seattle. It includes homes sold between May 2014 and May 2015.* id: a notation for a house* date: Date house was sold* price: Price is prediction TARGET!!* bedrooms: Number of Bedrooms/House* bathrooms: Number of bathrooms/House* sqft_living: square footage of the home* sqft_lot: square footage of the lot* floors: Total floors (levels) in house* waterfront: House which has a view to a waterfront* view: Has been viewed* condition: How good the condition is ( Overall )* grade: overall grade given to the housing unit, based on King County grading system* sqft_above: square footage of house apart from basement* sqft_basement: square footage of the basement* yr_built: Built Year* yr_renovated: Year when house was renovated* zip: codezip* lat: Latitude coordinate* long: Longitude coordinate* sqft_living15: Living room area in 2015(implies-- some renovations) This might or might not have affected the lotsize area* sqft_lot15: lotSize area in 2015(implies-- some renovations) Error metric: Mean Absolute Percentage Error $\frac{1}{n} \sum \frac{|y_{actual} - y_{pred}|}{y_{actual}}$<jupyter_code>import pandas as pd
import numpy as np

def score(y,y_pred):
    return np.mean(np.abs(y-y_pred)/y)

data = pd.read_csv('kc_house_data.csv')
data
column_selection = ["bedrooms","bathrooms","sqft_living","sqft_lot","floors"]
selected_feature = np.array(data[column_selection])
price = np.array(data[["price"]])
selected_feature_train = selected_feature[:20000]
price_train = price[:20000]
selected_feature_test = selected_feature[20000:]
price_test = price[20000:]
from sklearn.linear_model import LinearRegression
model = LinearRegression()
model.fit(selected_feature_train, price_train)
score(model.predict(selected_feature_test), price_test)
from sklearn.neural_network import MLPRegressor
model = MLPRegressor(hidden_layer_sizes=(20, 20, 20), learning_rate = "adaptive", verbose = True)
model.fit(selected_feature_train, price_train)
score(model.predict(selected_feature_test), price_test)<jupyter_output>C:\Users\Xiangyun\Anaconda3\lib\site-packages\sklearn\neural_network\multilayer_perceptron.py:1316: 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)
{'fraction_non_alphanumeric': 0.09642744230161239, 'fraction_numerical': 0.01707239962061334, 'mean_word_length': 6.427230046948357, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 6, 'lorem ipsum': 0, 'www.': 2, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '401960', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 1004, 'n_tokens_neox': 925, 'n_words': 304, 'path': 'Day03/Scikit-Learn.ipynb', 'repo_name': 'xcao0925/Bootcamp2019', 'size': '3163'}