Skip to content

Instantly share code, notes, and snippets.

View haydarai's full-sized avatar

Haydar Ali Ismail haydarai

View GitHub Profile
@haydarai
haydarai / Split independent-target.py
Last active January 6, 2017 13:48
Split independent and target values
X = bos.drop('PRICE', axis = 1)
Y = bos['PRICE']
@haydarai
haydarai / Mean Squared Error.py
Last active January 6, 2017 14:23
Check for Mean Squared Error on the predicted values
mse = sklearn.metrics.mean_squared_error(Y_test, Y_pred)
print(mse)
@haydarai
haydarai / Summary statistics.py
Last active January 6, 2017 14:24
Show summary statistics of Boston dataset
print(bos.describe())
@haydarai
haydarai / Insert price column.py
Last active January 6, 2017 14:24
Insert price column to the data frame
bos['PRICE'] = boston.target
print(bos.head())
@haydarai
haydarai / Add colum names.py
Last active January 6, 2017 14:24
Add column names to the data frame
bos.columns = boston.feature_names
print(bos.head())
@haydarai
haydarai / Convert to data frame.py
Last active January 6, 2017 14:24
Convert the dataset to Pandas DataFrame
bos = pd.DataFrame(boston.data)
print(bos.head())
@haydarai
haydarai / Dataset shape.py
Last active January 6, 2017 14:25
Check dataset shape
print(boston.data.shape)
@haydarai
haydarai / Check keys.py
Last active January 6, 2017 14:25
Check all available keys
print(boston.keys())
@haydarai
haydarai / hello-world.py
Created January 13, 2017 10:20
Word Count using MapReduce
from mrjob.job import MRJob
class mrWordCount(MRJob):
def mapper(self, key, line):
for word in line.split(' '):
yield word.lower(), 1
def reducer(self, word, occurrences):
yield word, sum(occurrences)
@haydarai
haydarai / input.txt
Created January 13, 2017 10:23
The example input for MapReduce's Hello World
I am Sam
I am Sam
Sam I am
That Sam I am
That Sam I am
I do not like
that Sam I am