Commit 096c4827 authored by Dr.李's avatar Dr.李

revert the change

parent e1b3b50e
...@@ -42,6 +42,7 @@ install: ...@@ -42,6 +42,7 @@ install:
- pip install cvxpy - pip install cvxpy
- pip install simpleutils - pip install simpleutils
- pip install coveralls - pip install coveralls
- pip install finance-python
script: script:
- export NUMBA_DISABLE_JIT=1 - export NUMBA_DISABLE_JIT=1
- export LD_LIBRARY_PATH="$PWD/libs/lib/linux:$LD_LIBRARY_PATH" - export LD_LIBRARY_PATH="$PWD/libs/lib/linux:$LD_LIBRARY_PATH"
......
...@@ -10,6 +10,7 @@ import numpy as np ...@@ -10,6 +10,7 @@ import numpy as np
from distutils.version import LooseVersion from distutils.version import LooseVersion
from sklearn import __version__ as sklearn_version from sklearn import __version__ as sklearn_version
from sklearn.linear_model import LinearRegression as LinearRegressionImpl from sklearn.linear_model import LinearRegression as LinearRegressionImpl
from PyFin.api import pyFinAssert
from alphamind.model.modelbase import ModelBase from alphamind.model.modelbase import ModelBase
from alphamind.utilities import alpha_logger from alphamind.utilities import alpha_logger
...@@ -21,7 +22,9 @@ class ConstLinearModel(ModelBase): ...@@ -21,7 +22,9 @@ class ConstLinearModel(ModelBase):
weights: np.ndarray=None): weights: np.ndarray=None):
super().__init__(features) super().__init__(features)
if features is not None and weights is not None: if features is not None and weights is not None:
assert len(features) == len(weights), "length of features is not equal to length of weights" pyFinAssert(len(features) == len(weights),
ValueError,
"length of features is not equal to length of weights")
self.weights = np.array(weights).flatten() self.weights = np.array(weights).flatten()
def fit(self, x: np.ndarray, y: np.ndarray): def fit(self, x: np.ndarray, y: np.ndarray):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment