Skip to main content

Fitchain Python Client

Project description

### What is this repository for? ###

* python based SDK
* v0.1

This repo implements the SDK to manage projects and models on a local fitchain pod

### Feedback ###
Reach out and tell us how we can improve this SDK to make it easier for you to work with the pod and build your models.

You may always drop us a mail at ``` code@fitchain.io ```


### Getting Started ###
#### Prequisites

Create a virtual environment

``` virtualenv -p python3 venv ```

``` . venv/bin/activate ```

and install all requirements in it

```pip3 install -r requirements.txt```

from this virtualenv run the code submitted by data scientist as in

```python ../../fitchain/machine-learning-models/mlp-reuters/train_mlp.py```


Make sure libmagic is installed:

```
brew install libmagic
```

####Fitchain sdk

First install the fitchain sdk using pip:
```bash
pip install fitchain
```

Once the fitchain sdk has been installed, you can use the library:

```python
from fitchain import Runtime

fc = Runtime()
```

Call the ```projects()``` method to get an overview of all available projects. You may even enter a query string to
filter your results.

```python
projects = fc.projects()
```

Once a project has been chosen, the datasources linked to the project can be retrieved using the ```datasources``` property

```python
project = projects[...]
project_datasources = project.datasources
```

Data for a specific datasource can be loaded by calling the ``` load(<datasource_id) ``` method on the project
```python
project_datasource_id = ...
project.load(project_datasource_id)
```

### Extracting schema and generating data
#### From data owner's pod

```
# Loading data and generating schema
df = dt.DataTemplate()
df.load_data(parentdir+ '/data/titanic_train.csv')
data_schema = df.get_template()

# Save schema to json file
schema_filepath = parentdir+'/data/titanic_schema.json'
print('Saving schema to disk at %s'%schema_filepath)
with open(schema_filepath, 'w') as outfile:
json.dump(data_schema, outfile)
del data_schema
```

#### From model owner's pod


```
# Generating dummy data from local schema
# load schema from json file
print('Loading schema from %s' % schema_filepath)
with open(schema_filepath) as json_data:
schema = json.load(json_data)
json_data.close()
pprint.pprint(schema)

dummy = dd.DummyData(schema)
dummy_df = dummy.generate_data()

# Write model on dummy_df
dummy_df.to_csv(parentdir+'/data/dummy_titanic.csv')
```


### Reference
The following methods are available as part of the SDK

##### Pod Identity #####
```python
identity = fc.identity()
```

##### List projects #####
```python
projects = fc.projects()
```

##### List workspaces #####
```python
workspaces = fc.workspaces()
```

##### List providers #####
```python
providers = fc.providers()
```

##### List Owned Datasources #####
```python
datasources = fc.datasources()
```

##### List jobs #####
```python
jobs = fc.jobs()
```


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fitchain-0.0.20.tar.gz (22.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fitchain-0.0.20-py3-none-any.whl (25.4 kB view details)

Uploaded Python 3

File details

Details for the file fitchain-0.0.20.tar.gz.

File metadata

  • Download URL: fitchain-0.0.20.tar.gz
  • Upload date:
  • Size: 22.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for fitchain-0.0.20.tar.gz
Algorithm Hash digest
SHA256 c2381c143ef6dc248c3b53199d75df5dadf04d15f6a0d4dd34b0fdadcef20552
MD5 d7a983baf0eda935a882c3818aa3a09e
BLAKE2b-256 66b68642390b625a4f28be4cd6cf73daccc99a3dd49f0b6567a482157baa160f

See more details on using hashes here.

File details

Details for the file fitchain-0.0.20-py3-none-any.whl.

File metadata

  • Download URL: fitchain-0.0.20-py3-none-any.whl
  • Upload date:
  • Size: 25.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for fitchain-0.0.20-py3-none-any.whl
Algorithm Hash digest
SHA256 2e3b0a602064a0aa9e94a1417c9c5c9e33a1daea61e97e3097c2d1aa193c0d05
MD5 d69dc28988de1b847ec8a3b0a774a216
BLAKE2b-256 a9072d734acfdf54ee7a4b4a5092866ca4b2633e146266d6dd3d061ba1b5f3d3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page