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
print mldb.put('/v1/functions/fetch', { | |
"type": 'fetcher', | |
"params": {} | |
}) | |
print mldb.put('/v1/functions/inception', { | |
"type": 'tensorflow.graph', | |
"params": { | |
"modelFileUrl": 'archive+'+ | |
'http://public.mldb.ai/models/inception_dec_2015.zip'+ |
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
kdNuggets = "http://www.skytree.net/wp-content/uploads/2014/08/KDnuggets.jpg" | |
mldb.query("SELECT inception({url: '%s'}) as *" % kdNuggets) |
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
print mldb.post("/v1/procedures", { | |
"type": "import.text", | |
"params": { | |
"dataFileUrl": "https://public.mldb.ai/datasets/car_brand_images/cars_urls.csv", | |
"outputDataset": "images" | |
} | |
}) | |
mldb.query("SELECT * FROM images LIMIT 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
mldb.query("SELECT count(*) FROM images GROUP BY brand") |
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
print mldb.post("/v1/procedures", { | |
"type": "transform", | |
"params": { | |
"inputData": """ | |
SELECT brand, | |
inception({url}) as * | |
FROM images | |
""", | |
"outputDataset": "training_dataset" | |
} |
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
rez = mldb.post("/v1/procedures", { | |
"type": "classifier.experiment", | |
"params": { | |
"experimentName": "car_brand_cls", | |
"inputData": """ | |
SELECT | |
{* EXCLUDING(brand)} as features, | |
brand as label | |
FROM training_dataset | |
""", |
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
pd.DataFrame(runResults["confusionMatrix"])\ | |
.pivot_table(index="actual", columns="predicted", fill_value=0) |
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
pd.DataFrame.from_dict(runResults["labelStatistics"]).transpose() |
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
print mldb.put("/v1/functions/brand_predictor", { | |
"type": "sql.expression", | |
"params": { | |
"expression": """ | |
car_brand_cls_scorer_0( | |
{ | |
features: inception({url}) | |
}) as * | |
""" | |
} |
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
mldb.get("/v1/functions/brand_predictor/application", | |
data={'input': | |
{'url': 'http://insideevs.com/wp-content/uploads/2016/03/JL82776-750x500.jpg'}}) |
OlderNewer