komprenilo / liga

Liga: Let Data Dance with ML Models
Apache License 2.0
10 stars 5 forks source link

Schema parser in Scala #84

Closed da-tubi closed 1 year ago

da-tubi commented 1 year ago

closes #82

Fact

There are two places a Liga schema is written:

  1. Python

    class Classifier(SklearnModelType):
    """Classification model type"""
    
    def schema(self) -> str:
        return "int"
    
    def predict(self, *args: Any, **kwargs: Any) -> List[int]:
        assert self.model is not None
        assert len(args) == 1
        return self.model.predict(args[0]).tolist()

    https://github.com/liga-ai/liga/blob/v0.2.0/python/liga/sklearn/models/classifier.py#L24-L33

  2. SQL

    CREATE OR REPLACE MODEL schema_test
    RETURNS int
    USING 'mlflow:///{registered_model_name}';

Impl Change

Use parse_schema in Scala instead of in Python