Sparse Aware MIL (sAwMIL)
sawmil.sawmil.sAwMIL
dataclass
sAwMIL(
C: float = 1.0,
kernel: KernelType = "Linear",
sil_kernel: KernelType = "Linear",
normalizer: str = "none",
p: float = 1.0,
scale_C: bool = True,
tol: float = 1e-08,
verbose: bool = False,
solver: str = "gurobi",
eta: float = 0.1,
min_pos_ratio: float = 0.05,
smil_: sMIL | None = None,
sil_: SVM | None = None,
classes_: NDArray[float64] | None = None,
coef_: NDArray[float64] | None = None,
intercept_: float | None = None,
cutoff_: float | None = None,
solver_params: Optional[dict] = None,
)
Bases: BaseEstimator, ClassifierMixin
Sparse Aware MIL (SVM)
decision_function
decision_function(
bags: Sequence[Bag] | BagDataset | Sequence[ndarray],
) -> npt.NDArray[np.float64]
Compute the decision function for the given bags.
Source code in src/sawmil/sawmil.py
193 194 195 196 197 198 199 200 201 202 203 204 | |
fit
fit(
bags: Sequence[Bag] | BagDataset | Sequence[ndarray],
y: Optional[NDArray[float64]] = None,
intra_bag_mask: Optional[Sequence[ndarray]] = None,
) -> "sAwMIL"
Fit the model to the training data.
Source code in src/sawmil/sawmil.py
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | |
predict
predict(
bags: Sequence[Bag] | BagDataset | Sequence[ndarray],
) -> npt.NDArray[np.float64]
Predict the labels for the given bags.
Source code in src/sawmil/sawmil.py
206 207 208 | |
score
score(bags, y_true) -> float
Compute the accuracy of the model on the given bags.
Source code in src/sawmil/sawmil.py
210 211 212 213 214 215 216 217 218 219 | |