Exemplo n.º 1
0
    def top_features(self, patient):
        if isinstance(patient, dict):
            import json
            patient = json.dumps(patient)

        named_features = ssf.extract_named_features(self._gateway.jvm, patient, self._features_spec)
        return [k for k, _ in named_features.items() if k in self._top_features]
Exemplo n.º 2
0
    def score(self, patient):
        if isinstance(patient, dict):
            import json
            patient = json.dumps(patient)

        # feature construction
        named_features = ssf.extract_named_features(self._gateway.jvm, patient, self._features_spec)
        feature_vector = ssf.to_sparse_feature_vector(self._feature_mapping, named_features)
        return self._pipeline.calibrated_score(feature_vector)