Esempio n. 1
0
def create_dataset_meta():
    url = 'http://localhost:8080/api/v1/dataset'

    dataset_meta = {
        "is_public":
        True,
        "title":
        "IMDB Movie reviews",
        "description":
        "Dataset of 25,000 movies reviews from IMDB, labeled by sentiment (positive/negative). Reviews have been preprocessed, and each review is encoded as a sequence of word indexes (integers). For convenience, words are indexed by overall frequency in the dataset, so that for instance the integer "
        "3"
        " encodes the 3rd most frequent word in the data. This allows for quick filtering operations such as: "
        "only consider the top 10,000 most common words, but eliminate the top 20 most common words"
        ".",
        "category":
        "classification"
    }

    r = utils.post(url, json=dataset_meta)
    print('Create dataset metadata: ', r.status_code, 'data:', r.text)

    if r.status_code == 200:
        return r.json()['id']

    raise RuntimeError('Status code', r.status_code, 'text:', r.text)
Esempio n. 2
0
def create_architecture():
    url = 'http://localhost:8080/api/v1/architecture'

    architecture = {
        "layers": [
            {
                "name": "Dense",
                "config": {
                    "units": 512,
                    "activation": "relu"
                }
            },
            {
                "name": "Dropout",
                "config": {
                    "rate": 0.2,
                }
            },
            {
                "name": "Dense",
                "config": {
                    "units": 512,
                    "activation": "relu"
                }
            },
            {
                "name": "Dropout",
                "config": {
                    "rate": 0.2,
                }
            },
            {
                "name": "Flatten"
            },
            {
                "name": "Dense",
                "config": {
                    "units": 10,
                    "activation": "softmax"
                }
            },
        ]
    }

    data = {
        "is_public": True,
        "title": "Irnn on mnist dataset",
        "architecture": architecture
    }

    resp = utils.post(url, json=data)

    if resp.status_code == 200:
        print('Create architecture status:', resp.status_code, 'data:',
              resp.text)
        return resp.json()['id']

    raise RuntimeError('status: {code} data: {text}'.format(
        code=resp.status_code, text=resp.text))
Esempio n. 3
0
def create_architecture():
    url = 'http://localhost:8080/api/v1/architecture'

    architecture = {
        "layers": [{
            "name": "Embedding",
            "config": {
                "input_dim": 5000,
                "output_dim": 50
            }
        }, {
            "name": "Dropout",
            "config": {
                "rate": 0.2
            }
        }, {
            "name": "Conv1D",
            "config": {
                "filters": 250,
                "kernel_size": [3],
                "padding": "valid",
                "activation": "relu",
                "strides": [1]
            }
        }, {
            "name": "Flatten"
        }, {
            "name": "Dense",
            "config": {
                "units": 250
            }
        }, {
            "name": "Dropout",
            "config": {
                "rate": 0.2
            }
        }, {
            "name": "Dense",
            "config": {
                "units": 2
            }
        }]
    }

    data = {
        "is_public": True,
        "title": "CNN architecture for imdb dataset",
        "architecture": architecture
    }

    resp = utils.post(url, json=data)

    if resp.status_code == 200:
        print('Create architecture status:', resp.status_code, 'data:',
              resp.text)
        return resp.json()['id']

    raise RuntimeError('status: {code} data: {text}'.format(
        code=resp.status_code, text=resp.text))
def create_architecture():
    url = 'http://localhost:8080/api/v1/architecture'

    architecture = {
        "layers": [{
            "name": "Dense",
            "config": {
                "units": 123,
                "activation": "asdsd",
                "use_bias": True,
                "kernel_initializer": "asdsrq",
                "bias_initializer": "asdasd",
                "kernel_regularizer": "adasdq1",
                "bias_regularizer": "112312",
                "activity_regularizer": "35654wd",
                "kernel_constraint": "ad123",
                "bias_constraint": "ad1356"
            }
        }, {
            "name": "Dropout"
        }, {
            "name": "Conv2D",
            "config": {
                "filters": 123,
                "kernel_size": [1, 2, 3],
                "strides": [1, 2],
                "padding": "in my ass",
                "dilation_rate": [1, 2],
                "activation": "asda",
                "use_bias": True,
                "kernel_initializer": "asdsrq",
                "bias_initializer": "asdasd",
                "kernel_regularizer": "adasdq1",
                "bias_regularizer": "112312",
                "activity_regularizer": "35654wd",
                "kernel_constraint": "ad123",
                "bias_constraint": "ad1356"
            }
        }, {
            "name": "Maxpooling2d"
        }]
    }

    data = {
        "id": "arch1",
        "is_public": True,
        "title": "title",
        "description": "description",
        "architecture": architecture
    }

    resp = utils.post(url, json=data)

    print('status:', resp.status_code, 'data:', resp.text)

    if resp.status_code == 200:
        return resp.json()['id']
Esempio n. 5
0
def train_model():
    ID = '9271a346e0e048f8adf17fdd09752951'
    url = 'http://localhost:8080/api/v1/model/{id}/train'.format(id=ID)

    config = {
        "dataset": "907dced87deb42d3b88ed8a34f94f920",
        "optimizer": "sgt",
        "loss": "mean_square_loss"
    }

    resp = utils.post(url, json=config)

    print('status:', resp.status_code, 'data:', resp.text)

    if resp.status_code == 200:
        return resp.json()['id']
Esempio n. 6
0
def create_dataset():
    url = 'http://localhost:8080/api/v1/dataset'

    json = {
        "is_public": True,
        "title": "Test Dataset {id}".format(id=int(time.time()) % 1000),
        "description": "Test test",
        "category": "classification",
    }

    resp = utils.post(url, json=json)

    print('status:', resp.status_code, 'data:', resp.text)

    if resp.status_code == 200:
        return resp.json()['id']
Esempio n. 7
0
def create_model(architecture_id, dataset_id):
    url = 'http://localhost:8080/api/v1/model'

    model = {
        "is_public": True,
        "title": "Classification CNN on imdb",
        "architecture": architecture_id,
        "dataset": dataset_id
    }

    resp = utils.post(url, json=model)

    if resp.status_code == 200:
        print('Create model status:', resp.status_code, 'data:', resp.text)
        return resp.json()['id']

    raise RuntimeError('status: {code} data: {text}'.format(code=resp.status_code, text=resp.text))
Esempio n. 8
0
def create_architecture():
    url = 'http://localhost:8080/api/v1/architecture'

    architecture = {
        "layers": [{
            "name": "Conv2D",
            "config": {
                "filters": 32,
                "kernel_size": [3, 3]
            }
        }, {
            "name": "MaxPooling2D",
            "config": {
                "pool_size": [2, 2]
            }
        }, {
            "name": "Conv2D",
            "config": {
                "filters": 32,
                "kernel_size": [3, 3]
            }
        }, {
            "name": "Flatten"
        }, {
            "name": "Dense",
            "config": {
                "units": 10
            }
        }]
    }

    data = {
        "is_public": True,
        "title": "CNN architecture fo cifar10 dataset",
        "architecture": architecture
    }

    resp = utils.post(url, json=data)

    if resp.status_code == 200:
        print('Create architecture status:', resp.status_code, 'data:',
              resp.text)
        return resp.json()['id']

    raise RuntimeError('status: {code} data: {text}'.format(
        code=resp.status_code, text=resp.text))
def create_dataset_metadata():
    url = 'http://localhost:8080/api/v1/dataset'
    
    dataset_meta = {
        "is_public": True,
        "title": "fashion-mnist",
        "description": "Dataset of 60,000 28x28 grayscale images of 10 fashion categories, along with a test set of 10,000 images. This dataset can be used as a drop-in replacement for MNIST.",
        "category": "classification"
    }

    r = utils.post(url, json=dataset_meta)
    print('Create dataset metadata: ', r.status_code, 'data:', r.text)
    
    if r.status_code == 200:
        return r.json()['id']
    
    raise RuntimeError('Status_code', r.status_code, r.text)
def create_dataset_metadata():
    url = 'http://localhost:8080/api/v1/dataset'

    dataset_meta = {
        "is_public": True,
        "title": "Boston housing price",
        "description":
        "Dataset taken from the StatLib library which is maintained at Carnegie Mellon University. Samples contain 13 attributes of houses at different locations around the Boston suburbs in the late 1970s. Targets are the median values of the houses at a location (in k$).",
        "category": "regression"
    }

    r = utils.post(url, json=dataset_meta)
    print('Create dataset metadata: ', r.status_code, 'data:', r.text)

    if r.status_code == 200:
        return r.json()['id']

    raise RuntimeError('Status_code', r.status_code, r.text)
Esempio n. 11
0
def create_dataset_meta():
    url = 'http://localhost:8080/api/v1/dataset'

    dataset_meta = {
        "is_public": True,
        "title": "Reuters newswire topics",
        "description":
        "Dataset of 11,228 newswires from Reuters, labeled over 46 topics. As with the IMDB dataset, each wire is encoded as a sequence of word indexes (same conventions).",
        "category": "classification"
    }

    r = utils.post(url, json=dataset_meta)
    print('Create dataset metadata: ', r.status_code, 'data:', r.text)

    if r.status_code == 200:
        return r.json()['id']

    raise RuntimeError('Status code', r.status_code, 'text:', r.text)
Esempio n. 12
0
def create_dataset_metadata():
    url = 'http://localhost:8080/api/v1/dataset'

    dataset_meta = {
        "is_public": True,
        "title": "cifar100",
        "description":
        "Dataset of 50,000 32x32 color training images, labeled over 100 categories, and 10,000 test images.",
        "category": "classification"
    }

    r = utils.post(url, json=dataset_meta)
    print('Create dataset metadata: ', r.status_code, 'data:', r.text)

    if r.status_code == 200:
        return r.json()['id']

    raise RuntimeError('Status_code', r.status_code, r.text)
Esempio n. 13
0
def train_cnn_cifar10(model_id):
    url = 'http://localhost:8080/api/v1/model/{id}/train'.format(id=model_id)

    config = {
        "epochs": 5,
        "optimizer": {
            "name": "Adam"
        },
        "loss": "binary_crossentropy"
    }

    resp = utils.post(url, json=config)

    if resp.status_code == 200:
        print('Train model status:', resp.status_code, 'data:', resp.text)
        return resp.json()['id']

    raise RuntimeError('status: {code} data: {text}'.format(code=resp.status_code, text=resp.text))
Esempio n. 14
0
def create_task():
    url = 'http://localhost:8080/api/v1/task'

    task = {
        "command": "model.train",
        "config": {
            "dataset": "d1",
            "accuracy": 0.7,
            "epochs": 10
        }
    }

    resp = utils.post(url, json=task)

    print('status:', resp.status_code, 'data:', resp.text)

    if resp.status_code == 200:
        return resp.json()['id']
Esempio n. 15
0
def create_architecture():
    url = 'http://localhost:8080/api/v1/architecture'

    architecture = {
        "layers": [{
            "name": "Embedding",
            "config": {
                "input_dim": 20000,
                "output_dim": 128
            }
        }, {
            "name": "LSTM",
            "config": {
                "units": 128,
                "dropout": 0.2,
                "recurrent_dropout": 0.2
            }
        }, {
            "name": "Dense",
            "config": {
                "units": 2,
                "activation": "sigmoid"
            }
        }]
    }

    data = {
        "is_public": True,
        "title": "LSTM architecture for imdb dataset",
        "architecture": architecture
    }

    resp = utils.post(url, json=data)

    if resp.status_code == 200:
        print('Create architecture status:', resp.status_code, 'data:',
              resp.text)
        return resp.json()['id']

    raise RuntimeError('status: {code} data: {text}'.format(
        code=resp.status_code, text=resp.text))
Esempio n. 16
0
def create_model_metadata():
    aid = create_architecture.create_architecture()
    did = create_dataset.create_dataset()

    url = 'http://localhost:8080/api/v1/model'

    model = {
        "is_public": True,
        "title": "Test Model {id}".format(id=int(time.time()) % 1000),
        "description": "Test test test",
        "labels": ["a", "b", "c"],
        "architecture": aid,
        "dataset": did
    }

    resp = utils.post(url, json=model)

    print('status:', resp.status_code, 'data:', resp.text)

    if resp.status_code == 200:
        return resp.json()['id']
Esempio n. 17
0
def create_architecture():
    url = 'http://localhost:8080/api/v1/architecture'

    architecture = {
        "layers": [
            {
                "name": "SimpleRNN",
                "config": {
                    "units": 100,
                    "kernel_initializer": "RandomNormal",
                    "recurrent_initializer": "Identity",
                    "activation": "relu"
                }
            },
            {
                "name": "Dense",
                "config": {
                   "units": 10,
                   "activation": "softmax"
                }
            }
        ]
    }

    data = {
        "is_public": True,
        "title": "Irnn on mnist dataset",
        "architecture": architecture
    }

    resp = utils.post(url, json=data)

    if resp.status_code == 200:
        print('Create architecture status:', resp.status_code, 'data:', resp.text)
        return resp.json()['id']

    raise RuntimeError('status: {code} data: {text}'.format(code=resp.status_code, text=resp.text))