Skip to content

Instantly share code, notes, and snippets.

import { Component } from '@angular/core';
@Component({
selector: 'income-query',
template: `
<div class='income-query'>
<input #income_input type='text' value='{{income}}' class='income-box'/>
<img (click)='breakup(income_input)' class='arrow-right' src='/resources/arrow-right.png'/>
</div>
`,
from random import randint
TRAIN_SET_LIMIT = 1000
TRAIN_SET_COUNT = 100
TRAIN_INPUT = list()
TRAIN_OUTPUT = list()
for i in range(TRAIN_SET_COUNT):
a = randint(0, TRAIN_SET_LIMIT)
b = randint(0, TRAIN_SET_LIMIT)
c = randint(0, TRAIN_SET_LIMIT)
from sklearn.linear_model import LinearRegression
predictor = LinearRegression(n_jobs=-1)
predictor.fit(X=TRAIN_INPUT, y=TRAIN_OUTPUT)
X_TEST = [[10, 20, 30]]
outcome = predictor.predict(X=X_TEST)
coefficients = predictor.coef_
print('Outcome : {}\nCoefficients : {}'.format(outcome, coefficients))
cred_file = open('credentials.json', 'r')
cred_json = json.load(cred_file)
cred_file.close()
public_key = cred_json['public_key']
secret_key = cred_json['secret_key']
upwork_client = upwork.Client(public_key, secret_key)
auth_url = upwork_client.auth.get_authorize_url()
# Opens a new tab in default web browser
webbrowser.open(url=auth_url, autoraise=True, new=2)
print 'Go to the mentioned URL : {}'.format(auth_url)
verifier = raw_input('Enter Verifier: ')
(token, token_secret) = upwork_client.auth.get_access_token(verifier)
upwork_client = upwork.Client(
public_key, secret_key,
oauth_access_token=token,
oauth_access_token_secret=token_secret)
while True:
# Get all latest jobs
print '\nGetting Jobs at {} ...\n'.format(
datetime.now().strftime('%H:%M'))
jobs = client.provider_v2.search_jobs(job_query)
current_jobs = set()
# Iterate every job
for job in jobs:
import pandas as pd
from sklearn.tree import DecisionTreeClassifier
train_data = pd.read_csv('train.csv')
test_data = pd.read_csv('train.csv')
survived = train_data['Survived']
train_data.drop('Survived', axis=1, inplace=True)
model = DecisionTreeClassifier()
def index
@articles = Article.all.to_json(
:only => [:id, :title, :status, :author]
)
end
def publish
article = Article.find(params[:id])
article.publish
render json: {