Comments (6)
That makes sense to me. Have you thought about how the API would look like?
from alphalens.
My idea would be to add a flag to create_factor_tear_sheet so that the user can supply the binning type (quantile or equal interval). Other than that we don't need additional api changes but we need a function similar to performance.quantize_factor that accepts the same input but returns the factor binned by value intervals instead of quantiles. We then call performance.quantize_factor or the new function depending on the binning type flag.
from alphalens.
Yes, a kwarg for the binning type makes sense.
from alphalens.
I thought about the api change again and an option would be to remove the "quantiles=5" argument from create_factor_tear_sheet function and add this new argument:
"binning_mode=(mode, mode_args)"
E.g.:
binning_mode=("quantiles", 5) #Number of uniform quantiles
binning_mode=("quantiles", [0, .15, .5, .85, 1.] ) # list of non uniform quantiles
binning_mode=("bins", 5) #number of equal-width bins
binning_mode=("bins", [-1, -0.3, 0., 0.3, 1] ) # list of bin edges allowing for non-uniform bin width
Also there is room for future addition of new modes.
Note: when "quantiles" mode is selected we'll end up calling pandas.qcut and when "bins" is provided we'll call pandas.cut
from alphalens.
That looks a bit bloated to me. What if we just have quantiles and bins and only one of them can be not-None?
from alphalens.
That sounds good too, let's go for that then.
from alphalens.
Related Issues (20)
- freq error: freq must be Day, BDay or CustomBusinessDay HOT 1
- How can I build my confidence that my strategy returns better HOT 1
- ufunc 'isfinite' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe'' HOT 6
- cumulative_returns calculation no longer adjusts for periods > 1?
- When I use "bins" instead of "quantiles", it went wrong
- UnboundLocalError: local variable 'period_len' referenced before assignment HOT 1
- Problem:create_event_returns_tear_sheet
- Dropped 45.5% entries from factor data: 45.5% in forward returns computation and 0.0% in binning phase (set max_loss=0 to see potentially suppressed Exceptions)
- Anyone can explain how the factors are bined? HOT 2
- Alphalens
- MissingDataError: exog contains inf or nans HOT 2
- importing alphalens 0.3.6 gets error "No module named 'pandas.util._decorators'" HOT 1
- AttributeError: 'Int64Index' object has no attribute 'tz' HOT 2
- Is alphalens still used? HOT 1
- got error: Error: No such keys(s): 'mode.use_inf_as_null'
- data = al.utils.get_clean_factor_and_forward_returns(cs_df.stack(), pricing, quantiles=5, bins=None, periods=[1])
- Unable to work with pyfolio integration
- invalid index to scalar variable @ mode(days_diffs).mode[0] HOT 11
- cant install alphalens from pip because of outdated configparser method call
- STOP USING WRITING READING
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from alphalens.