Implement Ploty into your Blog Posts

Get yourself some Toy-Data

I wrote a little Code Snippet that returns the “California Housing” dataset provided by sklearn as a named pandas dataframe. Ready for you to use in your applications.

1
2
3
4
5
6
7
8
9
10
11
import numpy as np
import pandas as pd
from sklearn.datasets import fetch_california_housing

dict_data = fetch_california_housing()

list_names = dict_data.feature_names
list_names.extend(dict_data.target_names)

data = np.concatenate([dict_data.data, dict_data.target.reshape(-1,1)], axis=1)
df = pd.DataFrame(data=data, columns=list_names)

I need some Data - Now!

Often times, we come up with an idea for a visualization or simply want to try out a new model we have heard off. In short: We need data.

However, this can sometimes become a tedious problem as a real world dataset might need additional cleaning, which can be too much effort for a short test or playing around. Here, a toy dataset can come in handy. There are tons of toy-data sets out there, many good ones presented by the sklearn.dataset module. In the example above I remodel the arrays provided by fetch_california into a pd.DataFrame.

For more information on the “California Housing” dataset visit sklearn.datasets.fetch_california.

Code Snippet Repository

This post is part of the Code Snippet Repository, a collection of short posts designed to make your everyday coding easier. These are based on public content from forums like stackoverflow and package documentations. You can find the code also in this repo on github!

More Intuitive Confusion Matrices

In classification problems, we often want to assess the quality of our model beyond a simple metric like the models accuracy, especially if we have many different classes or they are of different importance to us. In this short article, I show you a more intuitive way to present the quality of your classification model - a color coded Confusion Matrix.

Read more