-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/JAQPOT-62/torch-graph-training
- Loading branch information
Showing
146 changed files
with
1,512 additions
and
83,769 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# This workflow will install Python dependencies, run tests and lint with a single version of Python | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | ||
|
||
name: Build and test | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.10" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install flake8 pytest | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
- name: Lint with flake8 | ||
run: | | ||
# stop the build if there are Python syntax errors or undefined names | ||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | ||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | ||
- name: Test with pytest | ||
run: | | ||
pytest | ||
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Publish to PyPI 📦 | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
build-n-publish: | ||
name: Build and publish Python 🐍 distributions 📦 to PyPI | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@master | ||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: '3.10' | ||
- name: Install pypa/setuptools | ||
run: >- | ||
python -m | ||
pip install wheel | ||
- name: Extract tag name | ||
id: tag | ||
run: echo ::set-output name=TAG_NAME::$(echo $GITHUB_REF | cut -d / -f 3) | ||
- name: Update version in setup.py | ||
run: >- | ||
sed -i "s/{{VERSION_PLACEHOLDER}}/${{ steps.tag.outputs.TAG_NAME }}/g" setup.py | ||
- name: Build a binary wheel | ||
run: >- | ||
python setup.py sdist bdist_wheel | ||
- name: Publish distribution 📦 to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: "Lint PR" | ||
|
||
on: | ||
pull_request_target: | ||
types: | ||
- opened | ||
- edited | ||
- synchronize | ||
|
||
permissions: | ||
pull-requests: read | ||
|
||
jobs: | ||
main: | ||
name: Validate PR title | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: amannn/action-semantic-pull-request@v5 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,91 +1,93 @@ | ||
[![Build and test](https://github.com/ntua-unit-of-control-and-informatics/jaqpotpy/actions/workflows/ci.yml/badge.svg)](https://github.com/ntua-unit-of-control-and-informatics/jaqpotpy/actions/workflows/ci.yml) [![Publish to PyPI 📦](https://github.com/ntua-unit-of-control-and-informatics/jaqpotpy/actions/workflows/pipy_release.yml/badge.svg)](https://github.com/ntua-unit-of-control-and-informatics/jaqpotpy/actions/workflows/pipy_release.yml) | ||
|
||
# Jaqpotpy | ||
## _Standardizing molecular modeling_ | ||
|
||
# Jaqpot | ||
The jaqpotpy library enables you to upload and deploy machine learning models to the Jaqpot platform. Once uploaded, you can manage, document, and share your models via the Jaqpot user interface at **https://app.jaqpot.org**. You can also make predictions online or programmatically using the Jaqpot API. | ||
|
||
Jaqpot platform is a model repo developed in python and jaqpotpy making the models accessible through a user interface, that allows extensive documentation of the models and sharing through your contacts. | ||
## Getting Started | ||
|
||
### Prerequisites | ||
|
||
## jaqpotpy | ||
- Python 3.x | ||
- An account on **https://app.jaqpot.org** | ||
|
||
jaqpotpy enables model deployment with a simple command. | ||
### Installation | ||
|
||
### First register to Jaqpot through **https://app.jaqpot.org** | ||
Install jaqpotpy using pip: | ||
|
||
`jaqpot = Jaqpot()` initializes jaqpot upon the standard available API that | ||
is integrated with the application and user interface at **https://app.jaqpot.org/** . | ||
|
||
|
||
|
||
### Let jaqpot know who you are | ||
|
||
Login and have access on the jaqpot services | ||
|
||
In order to do so you can use the functions: | ||
|
||
* `jaqpot.login('username', 'password')` | ||
|
||
Will login and set the api key that is needed. | ||
|
||
* `jaqpot.request_key('username', 'password')` | ||
|
||
Same as above you request the key and set it on jaqpot | ||
|
||
* `jaqpot.request_key_safe()` | ||
|
||
Will ask the user for the username and password by hidding the password if | ||
jaqpot is used through a jupiter notebook etc | ||
```bash | ||
pip install jaqpotpy | ||
``` | ||
|
||
### Set Key without login | ||
### Logging In | ||
|
||
Some users may have logged in through google or github. At the account page | ||
a user can find an api key that can be used in order to have access on the services. | ||
These keys have short life and should be updated on each login. | ||
To use jaqpotpy, you need to log in to the Jaqpot platform. You can log in using your username and password or by setting an API key. | ||
|
||
* `jaqpot.set_api_key("api_key")` | ||
#### Login with Username and Password | ||
|
||
#### Get the key from user interface | ||
```python | ||
from jaqpotpy import Jaqpot | ||
|
||
jaqpot = Jaqpot() | ||
jaqpot.login('your_username', 'your_password') | ||
``` | ||
|
||
### Model training and deployment | ||
#### Request and Set API Key | ||
|
||
You can request an API key and set it: | ||
```python | ||
jaqpot.request_key('your_username', 'your_password') | ||
``` | ||
or | ||
```python | ||
jaqpot.request_key_safe() # Prompts for username and password securely | ||
``` | ||
#### Set API Key Directly | ||
|
||
An example code that demonstrates a model deployemnt. | ||
If you already have an API key (you can retrieve one from https://app.jaqpot.org), you can set it directly: | ||
|
||
```python | ||
jaqpot.set_api_key("your_api_key") | ||
``` | ||
|
||
### Model Training and Deployment | ||
|
||
Follow these steps to train and deploy your model on Jaqpot: | ||
|
||
* Warning! One of the things that may differ from simpler training and validation routes is that you need to train your model with a pandas dataframe as input and not with Numpy arrays! | ||
1. Train your model using pandas DataFrame as input. | ||
2. Deploy the trained model using the deploy_on_jaqpot function. | ||
|
||
#### Example Code | ||
_Note: Ensure you use a pandas DataFrame for training your model._ | ||
|
||
```python | ||
from jaqpotpy import Jaqpot | ||
import pandas as pd | ||
from sklearn.linear_model import LinearRegression | ||
|
||
# Initialize Jaqpot | ||
jaqpot = Jaqpot() | ||
|
||
# Load your data | ||
df = pd.read_csv('/path/to/gdp.csv') | ||
lm = LinearRegression() | ||
|
||
# Train your model | ||
lm = LinearRegression() | ||
y = df['GDP'] | ||
X = df[['LFG', 'EQP', 'NEQ', 'GAP']] | ||
|
||
model = lm.fit(X=X, y=y) | ||
|
||
jaqpot.deploy_sklearn(model, X, y, title="Title", description="Describe") | ||
# Deploy the model on Jaqpot | ||
jaqpot.deploy_sklearn(model, X, y, title="GDP Model", description="Predicting GDP based on various factors") | ||
``` | ||
|
||
The function will inform you about the model id that is created and is available through the user interface and the API. | ||
The function will provide you with the model ID that you can use to manage your model through the user interface and API. | ||
|
||
Result: | ||
```text | ||
- INFO - Model with ID: <model_id> created. Visit the application to proceed. | ||
``` | ||
|
||
* Result | ||
|
||
|
||
- INFO - Model with id: <model_id> created. Visit the application to proceed | ||
|
||
|
||
|
||
### Continue furter through the jaqpot user interface | ||
|
||
#### Managing Your Models | ||
|
||
You can further manage your models through the Jaqpot user interface at https://app.jaqpot.org. This platform allows you to view detailed documentation, share models with your contacts, and make predictions. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/sh | ||
|
||
# [DEPRECATED] Previous script to upload jaqpotpy library to pip | ||
# This will be moved to a github action after creating a release | ||
|
||
python setup.py bdist_wheel | ||
twine upload dist/* | ||
twine upload --repository testpypi dist/jaqpotpy-2.0.0b0-py3-none-any.whl | ||
twine upload dist/jaqpotpy-1.0.84-py3-none-any.whl | ||
docker build -t upcintua/jaqpotpy:1.0.3 --no-cache python setup.py bdist_wheel--build-arg tag=1.0.3 . |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Python Debugger: Current File", | ||
"type": "debugpy", | ||
"request": "launch", | ||
"program": "${file}", | ||
"console": "integratedTerminal", | ||
"justMyCode": false | ||
} | ||
] | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
from .jaqpot import Jaqpot | ||
|
||
|
||
__version__ = '1.0.100' |
This file contains 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
This file contains 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
Oops, something went wrong.