3fbe6c9be5
- 添加 vnpy_v4.4.0/ 目录到版本控制 - 删除嵌入的 .git 目录避免嵌套仓库 - 添加 README_SANGUO.md 说明来源和用途 - 更新 .gitignore 移除 vnpy_v4.4.0/ 忽略规则 上游代码信息: - 项目: VeighNa 量化交易平台 - 版本: 4.4.0 - 来源: https://github.com/vnpy/vnpy 用途: 版本参考、代码学习、差异对比、离线开发 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
31 lines
674 B
Python
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
|