예제 #1
0
def local_prediction(deepnets, test_reader, output, args, exclude=None):
    """Get local deepnet and issue prediction

    """
    kwargs = {"full": True}
    if args.operating_point_:
        kwargs.update({"operating_point": args.operating_point_})
    # Only one deepnet at present
    local_deepnet = Deepnet(deepnets[0], api=args.retrieve_api_)
    for input_data in test_reader:
        input_data_dict = test_reader.dict(input_data, filtering=False)
        prediction_info = local_deepnet.predict(input_data_dict, **kwargs)
        write_prediction(prediction_info, output, args.prediction_info,
                         input_data, exclude)
예제 #2
0
def local_prediction(deepnets, test_reader, output, args,
                     exclude=None):
    """Get local deepnet and issue prediction

    """
    # Only one deepnet at present
    local_deepnet = Deepnet(deepnets[0],
                            api=args.retrieve_api_)
    test_set_header = test_reader.has_headers()
    for input_data in test_reader:
        input_data_dict = test_reader.dict(input_data, filtering=False)
        prediction_info = local_deepnet.predict(
            input_data_dict, by_name=test_set_header)
        write_prediction(prediction_info, output,
                         args.prediction_info, input_data, exclude)
예제 #3
0
def local_prediction(deepnets, test_reader, output, args,
                     exclude=None):
    """Get local deepnet and issue prediction

    """
    kwargs = {"full": True}
    if args.operating_point_:
        kwargs.update({"operating_point": args.operating_point_})
    # Only one deepnet at present
    local_deepnet = Deepnet(deepnets[0],
                            api=args.retrieve_api_)
    for input_data in test_reader:
        input_data_dict = test_reader.dict(input_data, filtering=False)
        prediction_info = local_deepnet.predict(
            input_data_dict, **kwargs)
        write_prediction(prediction_info, output,
                         args.prediction_info, input_data, exclude)
예제 #4
0
def createRacingModel(dataset, type=util.ML_BIGML):
    if type == util.ML_BIGML:
        api = BigML(config.BIGML_USER, config.BIGML_API_KEY)
        print("Creating model...")
        args = {"name": "Racing Model", "objective_field": "Movement"}
        model = api.create_deepnet(dataset, args)
        api.ok(model)
        resource = model["resource"]
        # Saves model id to a file
        file = open("saved_models.txt", "a+")
        file.write(f"\nracing-{resource}")
        file.close()
        # Creates LOCAL model
        model = Deepnet(resource, api)
    return model
예제 #5
0
def i_create_local_deepnet_from_file(step, export_file):
    world.local_deepnet = Deepnet(res_filename(export_file))
예제 #6
0
def i_create_local_deepnet_from_file(step, export_file):
    world.local_deepnet = Deepnet(res_filename(export_file),
                                  api=BigML("wrong-user", "wrong-api-key"))
예제 #7
0
파일: tdc.py 프로젝트: ManojDjs/wescraping
import os.path
import json
import csv
import urllib.request
from urllib.parse import urlparse
from bs4 import BeautifulSoup
from bs4 import Comment
try:
    from urllib.parse import urlparse
except ImportError:
    import urlparse
BIGML_USERNAME = '******'
BIGML_API_KEY = 'd0ad30e1fa62ba453db353e2e6680866c0393cfb'
BIGML_STORAGE = 'D://Empty'
api = BigML(BIGML_USERNAME, BIGML_API_KEY, storage=BIGML_STORAGE)
deepnet = Deepnet('deepnet/5b867d8c8bf7d57a4302f787', api=api)
con = MongoClient('localhost', 27017)
db = con['Url_data']
collection=db['getJobs']
flag=0
list_=[]
rep_val=''
store_first_keyword=''
def insert_text_in_textBox():
    try:
        if(len(browser.find_elements_by_xpath("//input[@type='text']"))>=1):
            text_box = browser.find_elements_by_xpath("//input[@type='text']")
            text_box[0].send_keys("jobs")
    except:
        pass
def get_all_jobs(url,original_url,valid_urls):
예제 #8
0
def i_create_a_local_deepnet(step):
    world.local_model = Deepnet(world.deepnet['resource'])
    if hasattr(world, "local_ensemble"):
        world.local_ensemble = None
# Requires BigML Python bindings
#
# Install via: pip install bigml
#
# or clone it:
#   git clone https://github.com/bigmlcom/python.git
from bigml.deepnet import Deepnet
from bigml.api import BigML
# Downloads and generates a local version of the DEEPNET,
# if it hasn't been downloaded previously.
deepnet = Deepnet('deepnet/5c59efee00a1e50a6c0039ba',
                  api=BigML("rshelton",
                            "adabd734dd2a2af5cb4e49176f0eb472cfa8ce5a",
                            domain="bigml.io"))
# To make predictions fill the desired input_data in next line.
input_data = {
    "EMERG_VEH": "yes",
    "Division": "d42",
    "DISABILITY": "yes",
    "ACCLASS": "Non-Fatal Injury",
    "RDSFCOND": "Dry",
    "INVTYPE": "Driver",
    "IMPACTYPE": "Turning Movement",
    "ACCLOC": "At Intersection",
    "LIGHT": "Daylight",
    "VISIBILITY": "Clear",
    "Ward_Name": "scarborough",
    "INJURY": "None",
    "INVAGE": "unknown",
    "ALCOHOL": "yes",
    "REDLIGHT": "yes",
예제 #10
0
def modelFromID(resource, type=util.ML_BIGML):
    # Creates a local model based on a model id
    if type == util.ML_BIGML:
        api = BigML(config.BIGML_USER, config.BIGML_API_KEY)
        model = Deepnet(resource, api)
    return model
예제 #11
0
from flask import Flask, jsonify, request
from flask_cors import CORS
from predictor import Predictor
import numpy as np

from bigml.deepnet import Deepnet
from bigml.api import BigML
# Downloads and generates a local version of the DEEPNET,
# if it hasn't been downloaded previously.
deepnet = Deepnet('deepnet/5dba7bb15a21395ce200035a',
                  api=BigML("medias",
                            "1bbcaec3bdce36230a99d91fbf5597d0c5ea4fc4",
                            domain="bigml.io"))
pp = Predictor()
pp.load_pickle()
app = Flask(__name__)
CORS(app)
@app.route("/",methods=["GET","POST"])
def give():
    return jsonify({"status":"OK","message":"Hello"})
@app.route("/api/predict",methods=['POST'])
def predict():
    #Get Request Data
    content = request.json
    age = content['Age'] #numeric
    km = content['KM'] #numerci
    fueltype = content['FuelType'] #string
    if fueltype=='CNG':
        fueltype = 0
    elif fueltype=='Diesel':
        fueltype = 1