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 urllib2 | |
import json | |
import time | |
import pylab | |
import matplotlib.pyplot as plt | |
import matplotlib.animation as animation | |
def update_line(data): |
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
# | |
# A fatal error has been detected by the Java Runtime Environment: | |
# | |
# SIGSEGV (0xb) at pc=0x00007fdbb3a8e73f, pid=25807, tid=140581999658752 | |
# | |
# JRE version: Java(TM) SE Runtime Environment (7.0_80-b15) (build 1.7.0_80-b15) | |
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.80-b11 mixed mode linux-amd64 compressed oops) | |
# Problematic frame: | |
# C [libgdk-x11-2.0.so.0+0x5173f] gdk_display_open+0x3f | |
# |
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
#reducedDataFrame = bigDataFrame['2015-01-01 00:00:00':'2015-12-31 23:00:00'].loc[(slice(None),pollutedPlaces), :] | |
reducedDataFrame = bigDataFrame['2015-01-01 00:00:00':'2015-12-31 23:00:00'].loc[(slice(None), slice(None)), :] |
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
def C6H6qual (value): | |
if (value < 0.0): | |
return np.NaN | |
elif (value >= 0.0 and value <= 5.0): | |
return "1 Very good" | |
elif (value > 5.0 and value <= 10.0): | |
return "2 Good" | |
elif (value > 10.0 and value <= 15.0): | |
return "3 Moderate" | |
elif (value > 15.0 and value <= 20.0): |
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
worstPlace = descriptiveFrame.xs('6 Very bad', level=1)["overall"].idxmax() | |
descriptiveFrame.xs(worstPlace, level=0) |
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
stations = pd.read_excel("../input/Metadane_wer20160914.xlsx") | |
coolStation = [u'Gdańsk', u'Gdynia', u'Sopot', u'Kościerzyna'] | |
selectedStations = stations[stations[u'Miejscowość'].isin(coolStation)] | |
stationCodes = set(list(selected_stations[u'Kod stacji'].values) + list(selected_stations[u'Stary Kod stacji'].values)) |
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
reducedDataFrame = bigDataFrame['2015-01-01 01:00:00':'2016-01-01 00:00:00'].loc[(slice(None),stationCodes), :] |
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
heartData = pd.read_csv("../input/processed.cleveland.data", | |
names=["age", "sex", "cp", "trestbps", "chol", "fbs", "restecg", "thalach", "exang", | |
"oldpeak", "slope", "ca", "thal", "num"]) | |
heartData["ca"] = pd.to_numeric(heartData["ca"], errors='coerce') | |
heartData["thal"] = pd.to_numeric(heartData["thal"], errors='coerce') | |
heartData = heartData[(heartData["num"] == 0) | (heartData["num"] == 1)] | |
heartTarget = heartData["num"] | |
heartData = heartData.drop("num", axis=1) |
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
imp = Imputer(missing_values='NaN', strategy='mean', axis=0) | |
imp.fit(heartData) |
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
X_train, X_test, y_train, y_test = train_test_split(imp.transform(heartData),heartTarget.values) | |
tpot = TPOTClassifier(generations=5, population_size=50, verbosity=2) | |
tpot.fit(X_train, y_train) | |
print(tpot.score(X_test, y_test)) | |
tpot.export('../output/heart_pipeline.py') |
OlderNewer