Files
2026-07-13 12:07:23 +08:00

31 lines
674 B
Python

from abc import ABCMeta, abstractmethod
from typing import Any
import numpy as np
from vnpy.alpha.dataset import AlphaDataset, Segment
class AlphaModel(metaclass=ABCMeta):
"""Template class for machine learning algorithms"""
@abstractmethod
def fit(self, dataset: AlphaDataset) -> None:
"""
Fit the model with dataset
"""
pass
@abstractmethod
def predict(self, dataset: AlphaDataset, segment: Segment) -> np.ndarray:
"""
Make predictions using the model
"""
pass
def detail(self) -> Any:
"""
Output detailed information about the model
"""
return