Repository navigation
feat(ml): build Python ML pipeline against FeatureVector and ModelResult contract (#364) - #369
Draft
s6pa1rta3n-lab wants to merge 1 commit into
Draft
s6pa1rta3n-lab wants to merge 1 commit into
s6pa1rta3n-lab wants to merge 1 commit into
Conversation
…lResult contract - Extract NUMERIC_FEATURE_SPECS dynamically from packages/chenai-mlflow - Implement contract validation and missing-value imputation - Implement Stellar Horizon REST ingestion client - Implement FeatureBuilder transforming ledger history to contract-compliant vectors - Implement CreditScoreModel (GBM) and FraudDetectModel (IForest) with SHA-256 digests - Implement ModelResultEmitter with Soroban model-attestation compatibility - Implement FileDropSink, SqliteSink, and StdoutSink - Implement CLI and programmatic PipelineRunner - Add unit tests and bidirectional cross-language contract verification tests - Add GitHub Actions CI workflow for Python ML pipeline Closes nexoraorg#364
|
@s6pa1rta3n-lab is attempting to deploy a commit to the Isaac Gellu's projects Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This branch has not been deployed
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.
Summary
Implements the Python ML pipeline against the existing
FeatureVectorandModelResultcontract, closing #364.Key Components Implemented
ml/contract.py): Dynamically extractsNUMERIC_FEATURE_SPECSdirectly frompackages/chenai-mlflow/src/index.tsto preserve a single source of truth across languages. Implements strict validation and missing-value imputation adhering toFeatureVectorandModelResultschemas.ml/ingest.py):StellarHorizonClientconsuming Stellar Horizon REST API for accounts, operations, payments, and transactions.ml/features.py): Transforms raw Horizon ledger history into contract-compliantFeatureVectorpayloads.ml/models.py):CreditScoreModel: Gradient Boosting classifier producing calibrated risk scores in[0, 1]with risk labels (low,medium,high) and confidence values.FraudDetectModel: Isolation Forest anomaly detector producing calibrated anomaly risk scores in[0, 1].BytesN<32>incontracts/model-attestation.ml/emitter.py): Scores vectors, tracksimputedFields, and formats contract-compliantModelResultpayloads and Soroban model-attestation records.ml/sinks.py): SupportsFileDropSink(.jsonl or atomic per-account JSON),SqliteSink(indexed SQLite database), andStdoutSink.ml/pipeline.py): CLI and programmatic interface for single-subject Horizon scoring and batch file processing.ml/train.py): Trains models against synthetic datasetml/data/sample_dataset.json, emits tamper-evident signed evaluation reports (ml/evaluation_report.py), and writesml/artifacts/manifest.json.ml/tests/): 49 unit tests covering all modules, plus cross-language tests validating Python outputs in@chenaikit/chenai-mlflow's Node harness and vice versa..github/workflows/backend.yml): Adds automated Python ML testing job to GitHub Actions CI.Testing done
pytest ml/tests: 49 passed.pnpm --filter @chenaikit/chenai-mlflow run buildandpnpm --filter @chenaikit/chenai-mlflow run test: 53 passed.pnpm run test:integration: 11 passed.python3 ml/pipeline.py --mode single --subject-id GACC123 --sink stdoutpython3 ml/pipeline.py --mode batch --input-file ml/data/sample_vectors.jsonl --sink sqlite --output ml/output/scores.dbcheckPullRequestreturnedok: true.Checklist
fix-issue-364FeatureVectorandModelResult(schema version 1.0.0)ml/README.md.github/workflows/backend.ymlPayout Routing
0xF46C9F6d70C50BF81ef3588AB523a90a594a2F89GCL6OXAMLD75BMTINA6EMRUDWK5THQUSHMYNLSNBCJAPZJHNYJTUNIBC