virgo-modules 0.3.1__py3-none-any.whl → 0.3.3__py3-none-any.whl

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.

Potentially problematic release.


This version of virgo-modules might be problematic. Click here for more details.

@@ -1545,6 +1545,8 @@ def create_feature_edge(model, data,feature_name, threshold, target_variables):
1545
1545
  '''
1546
1546
  label_prediction = ['proba_'+x for x in target_variables]
1547
1547
  predictions = model.predict_proba(data)
1548
+ if isinstance(predictions, list):
1549
+ predictions = np.array([ x[:,1].T for x in predictions]).T
1548
1550
  predictions = pd.DataFrame(predictions, columns = label_prediction, index = data.index)
1549
1551
 
1550
1552
  result_df = pd.concat([data, predictions], axis=1)
@@ -1815,7 +1815,7 @@ class stock_eda_panel(object):
1815
1815
  self.target.append(f'mean_target')
1816
1816
  self.settings_target_lasts = {'steps':steps, 'type':'regression'}
1817
1817
 
1818
- def get_categorical_targets(self, horizon, flor_loss, top_gain):
1818
+ def get_categorical_targets(self, horizon, flor_loss, top_gain, min_pos=1 , min_negs=1):
1819
1819
  """
1820
1820
  produce binary target return taking future prices. it produce two targets, one for high returns and another for low returns
1821
1821
 
@@ -1824,6 +1824,8 @@ class stock_eda_panel(object):
1824
1824
  horizon (int): number of lags and steps for future returns
1825
1825
  flor_loss (float): min loss return
1826
1826
  top_gain (float): max gain return
1827
+ min_pos (int): minimun number of positives to count in a window for target_up
1828
+ min_negs (int): minimun number of negatives to count in a window for target_down
1827
1829
 
1828
1830
  Returns
1829
1831
  -------
@@ -1841,7 +1843,7 @@ class stock_eda_panel(object):
1841
1843
  self.df[f'target_{i}'] = np.where(self.df[f'target_{i}'] >= top_gain,1,0)
1842
1844
  columns.append(f'target_{i}')
1843
1845
  self.df[f'target_up'] = self.df[columns].sum(axis=1)
1844
- self.df[f'target_up'] = np.where(self.df[f'target_up'] >=1,1,0 )
1846
+ self.df[f'target_up'] = np.where(self.df[f'target_up'] >=min_pos,1,0 )
1845
1847
  self.df = self.df.drop(columns = columns)
1846
1848
 
1847
1849
  for i in range(1,horizon+1):
@@ -1851,7 +1853,7 @@ class stock_eda_panel(object):
1851
1853
  self.df[f'target_{i}'] = np.where(self.df[f'target_{i}'] <= flor_loss,1,0)
1852
1854
  columns.append(f'target_{i}')
1853
1855
  self.df[f'target_down'] = self.df[columns].sum(axis=1)
1854
- self.df[f'target_down'] = np.where(self.df[f'target_down'] >= 1,1,0 )
1856
+ self.df[f'target_down'] = np.where(self.df[f'target_down'] >= min_negs,1,0 )
1855
1857
  self.df = self.df.drop(columns = columns)
1856
1858
 
1857
1859
  self.targets.append('target_up')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: virgo-modules
3
- Version: 0.3.1
3
+ Version: 0.3.3
4
4
  Summary: data processing and statistical modeling using stock market data
5
5
  Home-page: https://github.com/miguelmayhem92/virgo_module
6
6
  Author: Miguel Mayhuire
@@ -4,15 +4,15 @@ virgo_modules/src/aws_utils.py,sha256=q0l7D7ofo09Lu1QQjv-esheQ06uiSy1Pdq3xMul8zv
4
4
  virgo_modules/src/backtester.py,sha256=OhiWyzDX0PthXGuhChyWUmDN3cLkzVYe95zS4nGtia8,22106
5
5
  virgo_modules/src/hmm_utils.py,sha256=fFWxmh9q3rjiKRHnxNk9k7O4fDrxVxkmp3pbpLvktjc,21116
6
6
  virgo_modules/src/pull_artifacts.py,sha256=5OPrgR7pcMSdpbevDRhf0ebk7g7ZRjff4NpTIIWAKjE,1989
7
- virgo_modules/src/re_utils.py,sha256=n5LD2IKURNsBsWeQ_xw98lh1YwLdl3efNLNT7qwFGzM,73863
8
- virgo_modules/src/ticketer_source.py,sha256=4vT8YweRtS28Zs66DBUG2rZ5EcFk9S0hiqNS_fz_I1c,100017
7
+ virgo_modules/src/re_utils.py,sha256=Exqe5eVGOpyb2j3veAsnFzXh-hXMwHe1zGTa_hO0wjI,73970
8
+ virgo_modules/src/ticketer_source.py,sha256=aiQ5fSnleLYH6ob12V6UgZ-D3KiNk9-yrSqXXf0oecE,100231
9
9
  virgo_modules/src/transformer_utils.py,sha256=LLwKYZRq5hrPVimnq3taD0Lh-q3Bq21fy1I4Icbnxi8,7677
10
10
  virgo_modules/src/edge_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  virgo_modules/src/edge_utils/conformal_utils.py,sha256=4gAOh2vxeWGR7iMF3TKnfQcLHlaH9M5B2lcmzo7V8AY,3755
12
12
  virgo_modules/src/edge_utils/edge_utils.py,sha256=U3GVyLgz0gEaR7AGjWseFcWt-IOusZvXJjwpBFknxNs,15643
13
13
  virgo_modules/src/edge_utils/shap_utils.py,sha256=OMKVO-4gtOng9GeSuhEgAEQe4FF3AtqXjm-GUBLqYFc,3349
14
- virgo_modules-0.3.1.dist-info/LICENSE,sha256=pNgFyCYgmimaw0o6V20JupZLROycAnOA_HDDh1tX2V4,1097
15
- virgo_modules-0.3.1.dist-info/METADATA,sha256=2Eu2wClOdTfVpfg7uqpeaBHOm651tvwStMeXuLeeNss,883
16
- virgo_modules-0.3.1.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
17
- virgo_modules-0.3.1.dist-info/top_level.txt,sha256=ZjI-qEkDtT-8mFwGAWnXfqPOKEGlIhWRW1es1VyXc60,14
18
- virgo_modules-0.3.1.dist-info/RECORD,,
14
+ virgo_modules-0.3.3.dist-info/LICENSE,sha256=pNgFyCYgmimaw0o6V20JupZLROycAnOA_HDDh1tX2V4,1097
15
+ virgo_modules-0.3.3.dist-info/METADATA,sha256=M996yB4xhvi7pZ7IiPVfect2SzKAHhXbwNFOcpIyrV0,883
16
+ virgo_modules-0.3.3.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
17
+ virgo_modules-0.3.3.dist-info/top_level.txt,sha256=ZjI-qEkDtT-8mFwGAWnXfqPOKEGlIhWRW1es1VyXc60,14
18
+ virgo_modules-0.3.3.dist-info/RECORD,,