Sklearn plot_tree plot is too small

I think the setting you are looking for is fontsize. You have to balance it with max_depth and figsize to get a readable plot. Here is an example from sklearn import tree from sklearn.datasets import load_iris import matplotlib.pyplot as plt # load data X, y = load_iris(return_X_y=True) # create and train model clf = tree.DecisionTreeClassifier(max_depth=4) … Read more

How to one-hot-encode from a pandas column containing a list?

We can also use sklearn.preprocessing.MultiLabelBinarizer: Often we want to use sparse DataFrame for the real world data in order to save a lot of RAM. Sparse solution (for Pandas v0.25.0+) from sklearn.preprocessing import MultiLabelBinarizer mlb = MultiLabelBinarizer(sparse_output=True) df = df.join( pd.DataFrame.sparse.from_spmatrix( mlb.fit_transform(df.pop(‘Col3’)), index=df.index, columns=mlb.classes_)) result: In [38]: df Out[38]: Col1 Col2 Apple Banana Grape Orange … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)