Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/additional parameters options predict #1546

Conversation

blythed
Copy link
Collaborator

@blythed blythed commented Dec 14, 2023

Description

This PR adds additional parameters to .predict to allow single outputs to be saved back into the database.
In addition, this adds a few new _Predictor descendants which allow users to implement search and easier model chaining.

Related Issues

Checklist

  • Is this code covered by new or existing unit tests or integration tests?
  • Did you run make test successfully?
  • Do new classes, functions, methods and parameters all have docstrings?
  • Were existing docstrings updated, if necessary?
  • Was external documentation updated, if necessary?

Additional Notes or Comments

@blythed blythed force-pushed the feature/additional-parameters-options-predict branch 6 times, most recently from 618f980 to 9e6293f Compare December 15, 2023 18:04
@codecov-commenter
Copy link

codecov-commenter commented Dec 15, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (34830a7) 80.33% compared to head (3ca2402) 80.30%.
Report is 1316 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1546      +/-   ##
==========================================
- Coverage   80.33%   80.30%   -0.04%     
==========================================
  Files          95      110      +15     
  Lines        6602     7691    +1089     
==========================================
+ Hits         5304     6176     +872     
- Misses       1298     1515     +217     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@blythed blythed force-pushed the feature/additional-parameters-options-predict branch from 9e6293f to d241c25 Compare December 15, 2023 18:38
@@ -722,6 +722,19 @@ def _delete(self, *args, **kwargs):
def execute(self, db):
return db.databackend.conn.table(self.identifier).execute()

def model_update(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't implemented this for SQL yet.

:param vector_index: The vector index to use
:param n: The number of results to return
"""

r: Document
r: t.Union[t.Dict, Document]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes it easier to pass data to vector-search.

'type_id': item.type_id,
'identifier': item.identifier,
'version': getattr(item, 'version', None),
def _serialize(item: t.Any, serialize_variables: bool = True):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function was not flexible enough and was overly complicated for what it did.
This should make it easier to understand.

return self.deserialize(r) # rebuild new class instance

def dict(self) -> t.Dict[str, t.Any]:
return asdict(self)


class Variable:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class allows queries to be included in a model,
and "crystallized" at runtime.

@blythed blythed force-pushed the feature/additional-parameters-options-predict branch from d241c25 to 3ca2402 Compare December 16, 2023 12:54
@blythed
Copy link
Collaborator Author

blythed commented Dec 16, 2023

Merging so that we can push ahead with this one. If comments/ feedback are relevant we can fix after the fact.

@blythed blythed merged commit 577e534 into superduper-io:main Dec 16, 2023
2 checks passed
@blythed blythed deleted the feature/additional-parameters-options-predict branch June 1, 2024 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants