mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-09 22:10:56 +08:00
Add data analysis feature for report (#918)
* Add data analysis feature for report * better display
This commit is contained in:
36
qlib/contrib/report/data/base.py
Normal file
36
qlib/contrib/report/data/base.py
Normal file
@@ -0,0 +1,36 @@
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT License.
|
||||
"""
|
||||
This module is responsible for analysing data
|
||||
|
||||
Assumptions
|
||||
- The analyse each feature individually
|
||||
|
||||
"""
|
||||
import pandas as pd
|
||||
from blocks.utils.log import logt
|
||||
from qlib.contrib.report.utils import sub_fig_generator
|
||||
|
||||
|
||||
class FeaAnalyser:
|
||||
def __init__(self, dataset: pd.DataFrame):
|
||||
self._dataset = dataset
|
||||
with logt("calc_stat_values"):
|
||||
self.calc_stat_values()
|
||||
|
||||
def calc_stat_values(self):
|
||||
pass
|
||||
|
||||
def plot_single(self, col, ax):
|
||||
raise NotImplementedError(f"This type of input is not supported")
|
||||
|
||||
def skip(self, col):
|
||||
return False
|
||||
|
||||
def plot_all(self, *args, **kwargs):
|
||||
|
||||
ax_gen = iter(sub_fig_generator(*args, **kwargs))
|
||||
for col in self._dataset:
|
||||
if not self.skip(col):
|
||||
ax = next(ax_gen)
|
||||
self.plot_single(col, ax)
|
||||
Reference in New Issue
Block a user