Calmcode - human learn: function

Function

1 2 3 4 5 6 7 8

Let's first show how we can use a python function to make a classification.

Before running the code, make sure you've installed the package.

python -m pip install human-learn

The fare_based function defined below can be used to make predictions.

from hulearn.datasets import load_titanic

df = load_titanic(as_frame=True)
X, y = df.drop(columns=['survived']), df['survived']

def fare_based(dataf, threshold=10):
    return np.array(dataf['fare'] > threshold).astype(int)

In the next video we'll explore how to make it into a scikit-learn compatible classifier.