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 collections import Counter | |
import operator | |
c=Counter(x) | |
sortlist = c.most_common(150) | |
topwords = list(map(operator.itemgetter(0), sortlist)) | |
topcounts= list(map(operator.itemgetter(1), sortlist)) | |
maxcount = sortlist[0][1] | |
mincount = sortlist[149][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
x = df.explode() | |
len(set(x)) |
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
df=data[0].str.split() | |
df.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 | |
data = pd.read_csv('2016-06.pgn', header = None) | |
print(data.shape) | |
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
import chess.svg | |
san ='''d4 d5 c4 c6 e3 a6 Nf3 e5 cxd5 e4 Ne5 cxd5 Qa4+ Bd7 Nxd7 Nxd7 Nc3 Nf6 Qb3 Be7 Nxd5 Qa5+ Nc3 O-O Be2 b5 O-O Rad8 | |
Bd2 Qc7 Rac1 Qd6 Qc2 Qe6 Nb1 Bd6 a3 Nb6 Qc6 Nfd5 Ba5 Rc8 Qb7 Qh6 h3 Nc4 Bxc4 bxc4 Qxd5 Rfd8 Qxe4 Rd7 Bc3 Re7 Qf3 Re6 Nd2 | |
Rf6 Qg4 Re8 Ne4 Rg6 Qd7 Rf8 Nxd6 Rxd6 Qc7 Rg6 Qh2 Re8 d5 f6 d6 Rd8 Rfd1''' | |
partie = san.split() | |
board = chess.Board() |
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.ensemble import RandomForestClassifier | |
plot = decision_boundaries(X,y,RandomForestClassifier, max_depth= 5, n_estimators = 50) | |
plot.show() |
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.tree import DecisionTreeClassifier | |
plot = decision_boundaries(X,y,DecisionTreeClassifier, max_depth= 4) | |
plot.show() |
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.neural_network import MLPClassifier | |
plot = decision_boundaries(X,y,MLPClassifier,hidden_layer_sizes=(25,25,25), | |
solver='lbfgs',alpha=1e-5,max_iter=3000) | |
plot.show() |
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
plot = decision_boundaries(X,y,SVC, kernel='poly', degree=10) | |
plot.show() |
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
plot = decision_boundaries(X,y,SVC, kernel='poly', degree=4) | |
plot.show() |