numerai-tools 0.4.2.dev0__tar.gz → 0.4.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {numerai_tools-0.4.2.dev0 → numerai_tools-0.4.3}/PKG-INFO +1 -1
- {numerai_tools-0.4.2.dev0 → numerai_tools-0.4.3}/numerai_tools/scoring.py +12 -14
- {numerai_tools-0.4.2.dev0 → numerai_tools-0.4.3}/numerai_tools.egg-info/PKG-INFO +1 -1
- {numerai_tools-0.4.2.dev0 → numerai_tools-0.4.3}/setup.py +1 -1
- {numerai_tools-0.4.2.dev0 → numerai_tools-0.4.3}/LICENSE +0 -0
- {numerai_tools-0.4.2.dev0 → numerai_tools-0.4.3}/README.md +0 -0
- {numerai_tools-0.4.2.dev0 → numerai_tools-0.4.3}/numerai_tools/__init__.py +0 -0
- {numerai_tools-0.4.2.dev0 → numerai_tools-0.4.3}/numerai_tools/py.typed +0 -0
- {numerai_tools-0.4.2.dev0 → numerai_tools-0.4.3}/numerai_tools/signals.py +0 -0
- {numerai_tools-0.4.2.dev0 → numerai_tools-0.4.3}/numerai_tools/submissions.py +0 -0
- {numerai_tools-0.4.2.dev0 → numerai_tools-0.4.3}/numerai_tools.egg-info/SOURCES.txt +0 -0
- {numerai_tools-0.4.2.dev0 → numerai_tools-0.4.3}/numerai_tools.egg-info/dependency_links.txt +0 -0
- {numerai_tools-0.4.2.dev0 → numerai_tools-0.4.3}/numerai_tools.egg-info/requires.txt +0 -0
- {numerai_tools-0.4.2.dev0 → numerai_tools-0.4.3}/numerai_tools.egg-info/top_level.txt +0 -0
- {numerai_tools-0.4.2.dev0 → numerai_tools-0.4.3}/setup.cfg +0 -0
- {numerai_tools-0.4.2.dev0 → numerai_tools-0.4.3}/tests/test_scoring.py +0 -0
- {numerai_tools-0.4.2.dev0 → numerai_tools-0.4.3}/tests/test_signals.py +0 -0
- {numerai_tools-0.4.2.dev0 → numerai_tools-0.4.3}/tests/test_submissions.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: numerai_tools
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.3
|
|
4
4
|
Summary: A collection of open-source tools to help interact with Numerai, model data, and automate submissions.
|
|
5
5
|
Home-page: https://github.com/numerai/numerai-tools
|
|
6
6
|
Maintainer: Numerai
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
from typing import List, Tuple, Union, Optional, TypeVar
|
|
2
2
|
|
|
3
|
-
import torch
|
|
4
3
|
import numpy as np
|
|
5
4
|
import pandas as pd # type: ignore
|
|
6
5
|
from scipy import stats # type: ignore
|
|
@@ -462,7 +461,7 @@ def numerai_corr(
|
|
|
462
461
|
Returns:
|
|
463
462
|
pd.Series - the resulting correlation scores for each column in predictions
|
|
464
463
|
"""
|
|
465
|
-
targets = targets
|
|
464
|
+
targets = center(targets)
|
|
466
465
|
targets, predictions = filter_sort_index(
|
|
467
466
|
targets, predictions, max_filtered_index_ratio
|
|
468
467
|
)
|
|
@@ -558,14 +557,15 @@ def alpha(
|
|
|
558
557
|
sample_weights: pd.Series - the universe sampling weights
|
|
559
558
|
targets: pd.Series - the live targets to evaluate against
|
|
560
559
|
"""
|
|
560
|
+
targets = center(targets)
|
|
561
561
|
assert not predictions.isna().any().any(), "Predictions contain NaNs"
|
|
562
562
|
assert not neutralizers.isna().any().any(), "Normalization factors contain NaNs"
|
|
563
563
|
assert not sample_weights.isna().any(), "Weights contain NaNs"
|
|
564
564
|
predictions, neutralizers, sample_weights, targets = filter_sort_index_many(
|
|
565
565
|
[predictions, neutralizers, sample_weights, targets]
|
|
566
566
|
)
|
|
567
|
-
|
|
568
|
-
weights =
|
|
567
|
+
ranked_preds = tie_kept_rank__gaussianize__pow_1_5(predictions)
|
|
568
|
+
weights = ranked_preds.apply(
|
|
569
569
|
lambda s_prime: generate_neutralized_weights(
|
|
570
570
|
s_prime, neutralizers, sample_weights
|
|
571
571
|
)
|
|
@@ -594,6 +594,7 @@ def meta_portfolio_contribution(
|
|
|
594
594
|
sample_weights: pd.Series - the universe sampling weights
|
|
595
595
|
targets: pd.Series - the live targets to evaluate against
|
|
596
596
|
"""
|
|
597
|
+
targets = center(targets)
|
|
597
598
|
assert not predictions.isna().any().any(), "Predictions contain NaNs"
|
|
598
599
|
assert not neutralizers.isna().any().any(), "Normalization factors contain NaNs"
|
|
599
600
|
assert not sample_weights.isna().any(), "Weights contain NaNs"
|
|
@@ -612,15 +613,12 @@ def meta_portfolio_contribution(
|
|
|
612
613
|
t = targets.values
|
|
613
614
|
swp = w @ s
|
|
614
615
|
swp = swp - swp.mean()
|
|
615
|
-
|
|
616
|
+
l1_norm = np.sum(np.abs(swp))
|
|
617
|
+
l1_norm_squared = np.power(l1_norm, 2)
|
|
616
618
|
swp_sign = np.sign(swp)
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
)
|
|
622
|
-
zero_mean_jac_vec_prod = (
|
|
623
|
-
alpha_unnormalized_swp_grad - alpha_unnormalized_swp_grad.mean()
|
|
624
|
-
)
|
|
625
|
-
mpc = (w.T @ zero_mean_jac_vec_prod).squeeze()
|
|
619
|
+
swp_alpha = np.dot(swp, t)
|
|
620
|
+
directional_gradient = l1_norm * t - swp_sign * swp_alpha
|
|
621
|
+
jacobian_vector_product = directional_gradient.reshape(-1, 1) / l1_norm_squared
|
|
622
|
+
centered_jacobian = jacobian_vector_product - jacobian_vector_product.mean()
|
|
623
|
+
mpc = (w.T @ centered_jacobian).squeeze()
|
|
626
624
|
return pd.Series(mpc, index=stakes.index)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: numerai-tools
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.3
|
|
4
4
|
Summary: A collection of open-source tools to help interact with Numerai, model data, and automate submissions.
|
|
5
5
|
Home-page: https://github.com/numerai/numerai-tools
|
|
6
6
|
Maintainer: Numerai
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{numerai_tools-0.4.2.dev0 → numerai_tools-0.4.3}/numerai_tools.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|