Keras Callback to track Numerai consistency
Project description
A Keras callback that calculates your model’s consistency during training at each epoch. The callback prints the consistency and also adds the consistency at the end of each epoch to the training history under the consistency key.
Usage
Here is a usage example:
import pandas as pd
from numeraicb import Consistency
from keras.models import Sequential
from keras.layers.core import Dense
train = pd.read_csv('numerai_training_data.csv')
tourn = pd.read_csv('numerai_tournament_data.csv')
validation = tourn[tourn.data_type == 'validation']
features = ['feature{}'.format(i) for i in range(1, 51)]
X = train[features].values
Y = train.target.values
X_validation = validation[features].values
Y_validation = validation.target.values
model = Sequential()
model.add(Dense(30, kernel_initializer='uniform', input_dim=X.shape[1], activation='relu'))
model.add(Dense(1, activation='sigmoid'))
model.compile(optimizer='adamax', loss='binary_crossentropy')
cb = Consistency(tourn)
# Now your models consistency will be printed at each epoch
history = model.fit(X, Y, callbacks=[cb], validation_data=(X_validation, Y_validation))
# Consistency is stored in the history as well
for epoch, consistency in enumerate(history.history['consistency']):
print('consistency at epoch {}: {:.2%}'.format(epoch, consistency))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file numeraicb-1.0.1.tar.gz.
File metadata
- Download URL: numeraicb-1.0.1.tar.gz
- Upload date:
- Size: 15.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0aaeab3b860581d7cb347357e407a9fe9b1278e0c372184d0699d7090ffaf9b3
|
|
| MD5 |
3ca9473169ac5f19fa43f072ce3cee3f
|
|
| BLAKE2b-256 |
7f8abf5f60a161f3fcbd1424ea5304d2077c0120e66c83f0d14a3ac357261ccf
|
File details
Details for the file numeraicb-1.0.1-py3-none-any.whl.
File metadata
- Download URL: numeraicb-1.0.1-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6cbbf5b911f42468eaa310527dc618a236d4df05cf773cfa1359a089e86428a3
|
|
| MD5 |
22a7d9b7ae635b3aff8a39d7dd47fba0
|
|
| BLAKE2b-256 |
18b284a1b756aa1418d2f1579a7399056448720cce1f103c6b30518b82734f72
|