-
Notifications
You must be signed in to change notification settings - Fork 0
Create Simple-ML stub files #292
Comments
Should two separate directories be generated for the adapter and stub files or should they be placed in the same one? Example: api-editor_inferredAPI/adapter/simpleml/model/test.py or: I assume the second approach of placing them in the same directories is the desired solution, please correct me if I got that wrong. |
This, only with an extension of |
What is the expected output for a class without a constructor? |
Reason: There's always a default parameterless constructor in Python. |
Is your feature request related to a problem? Please describe
In addition to the Python files that are generated in #288, Simple-ML stub files should be generated.
Stub files syntax
Let's go through this step by step:
Package declaration as in Java. Corresponds to a Python file
simpleml/model/regression.py
.Imports like in Java. First we import a declaration called
Dataset
from thesimpleml.dataset
package then a declaration calledEstimator
fromsimpleml.model
.Declares that a class called
Lasso
exists in this package (simpleml.model.regression
) and that it is open for extension. Opposite to Java classes arefinal
by default and need to be marked explicitly as open so other classes can inherit from them.The class has a constructor (
__init__
function in Python) that take on parameter calledregularizationStrength
of typeFloat
and has a default value of0.5
. Theself
parameter from Python must not be added and is implicitly assumed.The class is a subclass of
Estimator
.The class has an attribute (instance variable) called
regularizationStrength
with typeFloat
.The class overrides the function called
fit
it inherits fromEstimator
. It takes two parameters calledfeatures
andtarget
, both of which have typeDataset
and produces one result calledtrainedModel
that has typeTrainedLasso
.A global function called
println
that takes one parameter that is an instance of any type ornull
(indicated by the question mark).null
corresponds toNone
in Python and the question mark toOptional
.Limitations
Not all the information specified above is available yet. Here's a list of possible problems and their resolution:
Any?
as the type.open
,sub
,override
). In a first iteration we may ignore subclassing and omit all this information. The work necessary to implement this is tracked separately in Handle subclassing properly in stub files #293.Tasks
The text was updated successfully, but these errors were encountered: