Add a refinement-typed ML library and Titanic example - #492
Open
joaokorreia wants to merge 13 commits into
Open
Conversation
cursor
Bot
force-pushed
the
machine_learning_library
branch
from
August 19, 2026 03:01
59c80fa to
76424c5
Compare
alcides
requested changes
Aug 19, 2026
| """Owned wrapper around a pandas DataFrame.""" | ||
|
|
||
| value: pd.DataFrame | ||
| _consumed: bool = field(default=False, init=False, repr=False) |
Owner
There was a problem hiding this comment.
Can't we have this verification just using linear types in the language, instead of spending memory with the field (and runtime cost)?
Or is there any reason for this choice that I'm missing?
|
|
||
| features: pd.DataFrame | ||
| target: pd.Series | ||
| split_token: object = field(repr=False) |
Owner
There was a problem hiding this comment.
I don't understand that the split_token is.
|
|
||
| def _require_available(resource: LinearResource, expected_type: type, operation: str) -> None: | ||
| if not isinstance(resource, expected_type): | ||
| raise TypeError(f"{operation} esperava {expected_type.__name__}, recebeu {type(resource).__name__}") |
Owner
There was a problem hiding this comment.
We need the errors (and everything) in English.
| # TODO: Consider moving the four-row validation to ``target``, where the | ||
| # target-class distribution is known. | ||
| def read_csv (path: String) : | ||
| {df: DataFrame | df_rows df >= 4 && df_cols df >= 2} := |
Owner
There was a problem hiding this comment.
Why do we have a requirement of 4 rows?
| let 1 df := read_csv "examples/machine_learning/titanic.csv" in | ||
| let first_dataset := target df 1 in | ||
| let second_dataset := target df 1 in | ||
| 0.0 |
Owner
There was a problem hiding this comment.
Boa! São estes os tipos de exemplos que precisamos!
Precisamos é da documentação em inglês.
cursor
Bot
force-pushed
the
machine_learning_library
branch
2 times, most recently
from
August 23, 2026 03:03
f2b20aa to
a3f8029
Compare
alcides
marked this pull request as ready for review
August 31, 2026 13:04
cursor
Bot
force-pushed
the
machine_learning_library
branch
from
September 1, 2026 03:04
a3f8029 to
3629c5d
Compare
alcides
approved these changes
Sep 1, 2026
- Introduced a new example for training and evaluating a decision tree classifier on the Titanic dataset. - Updated `pyproject.toml` to include pandas and scikit-learn as dependencies. - Created comprehensive tests for the machine learning library, covering data reading, dataset validation, and model training/evaluation. - Ensured that the tests validate the ownership protocol and resource consumption rules in the library.
- Introduced a new example for training and evaluating a decision tree classifier on the Titanic dataset. - Updated `pyproject.toml` to include pandas and scikit-learn as dependencies. - Created comprehensive tests for the machine learning library, covering data reading, dataset validation, and model training/evaluation. - Ensured that the tests validate the ownership protocol and resource consumption rules in the library.
cursor
Bot
force-pushed
the
machine_learning_library
branch
from
September 2, 2026 03:02
3629c5d to
1094e0a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Design
The binding now represents datasets and split parts with ordinary pandas objects and tuples. Linear consumption and compatibility are checked by Aeon before evaluation.
Properties that depend on the contents of an arbitrary external CSV cannot be inferred from its path alone. This revision therefore does not claim unverified class-count or per-class distribution facts. The Titanic example explicitly supplies its audited column count through assume_columns; a future version could replace this trusted schema assumption with a dedicated witness if that is the preferred API.
The arbitrary four-row requirement was removed because it does not guarantee that an arbitrary stratified split is valid.
Static guarantees covered by examples
Validation
The default Windows mypy invocation still reports the repository's existing Unix-only signal.SIGALRM, setitimer, and ITIMER_REAL attributes. The equivalent Linux-platform check above passes.