Address numpy.matrix deprecation
open-risk opened this issue · 1 comments
open-risk commented
numpy.matrix is on a deprecation path, given than a transitionMatrix object derives from it, some alternative should be developed
epogrebnyak commented
I think the depreciation is an opportunity to revisit the structure of the classes - they are so overloaded now with IO operations, matrix validation, manipulation, etc.
Can anything simple as below work?
from typing import List
import numpy as np
TM = np.ndarray
TMSet = List[TM]
def empty(dimensions: int) -> TM:
return np.identity(dimension)
Another idea is to hide ndarray
behind a dataclass, but leave non-essential methods out:
from dataclasses import dataclass
@dataclass
class TransitionMatrix:
matrix: np.ndarray
def matrix(values) -> TransitionMatrix:
pass
def read_csv(filename) -> TransitionMatrix:
pass
transitionMatrix/transitionMatrix/model.py
Lines 204 to 211 in f69c589