This file contains hidden or 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
# BM25F Model | |
def bm25(idf, tf, fl, avgfl, B, K1): | |
# idf - inverse document frequency | |
# tf - term frequency in the current document | |
# fl - field length in the current document | |
# avgfl - average field length across documents in collection | |
# B, K1 - free paramters | |
return idf * ((tf * (K1 + 1)) / (tf + K1 * (1 - B + B * (fl / avgfl)))) |
This file contains hidden or 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
#-*- coding:utf-8 - *- | |
def load_dataset(): | |
"Load the sample dataset." | |
return [[1, 3, 4], [2, 3, 5], [1, 2, 3, 5], [2, 5]] | |
def createC1(dataset): | |
"Create a list of candidate item sets of size one." |
This file contains hidden or 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
import json | |
import re | |
import grequests | |
import pandas as pd | |
import requests | |
from bs4 import BeautifulSoup | |
from bs4.diagnose import profile | |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
def map_feature(x1, x2): | |
''' | |
Maps the two input features to quadratic features. | |
Returns a new feature array with more features, comprising of | |
X1, X2, X1 ** 2, X2 ** 2, X1*X2, X1*X2 ** 2, etc... | |
Inputs X1, X2 must be the same size | |
''' | |
x1.shape = (x1.size, 1) |
This file contains hidden or 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
import subprocess | |
def check_dependencies(): | |
"""Ensure required tools for installation are present. | |
""" | |
print("Checking required dependencies") | |
for cmd, param, url in [("git", '--version', "http://git-scm.com/"), |
This file contains hidden or 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
<?xml version='1.0' encoding='UTF-8'?> | |
<TrainingCenterDatabase xmlns:ext="http://www.garmin.com/xmlschemas/ActivityExtension/v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2"> | |
<Activities> | |
<Activity Sport="Running"> | |
<Id>2012-12-26T21:29:53Z</Id> | |
<Notes>Aerobics</Notes> | |
<Lap StartTime="2012-12-26T21:29:53Z"> | |
<TotalTimeSeconds>608.47</TotalTimeSeconds> | |
<DistanceMeters>1609.34399414</DistanceMeters> | |
<MaximumSpeed>4.55431461334</MaximumSpeed> |
This file contains hidden or 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
import requests | |
from BeautifulSoup import BeautifulSoup | |
def megasena_api(): | |
URL_ULTIMOS_RESULTADOS = 'http://www1.caixa.gov.br/loterias/loterias/megasena/megasena_pesquisa_new.asp' | |
page = requests.get(URL_ULTIMOS_RESULTADOS) | |
bs = BeautifulSoup(page.content) | |
numeros_sena = [ n.contents[0] for n in bs.findAll('li')[:6]] | |
results = page.content.split('|') |
This file contains hidden or 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
from numpy import loadtxt, zeros, ones, array, linspace, logspace | |
from pylab import scatter, show, title, xlabel, ylabel, plot, contour | |
#Evaluate the linear regression | |
def compute_cost(X, y, theta): | |
''' | |
Comput cost for linear regression | |
''' | |
#Number of training samples |
This file contains hidden or 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
version: "2" | |
services: | |
web: | |
build: . | |
#command: python3 manage.py runserver 0.0.0.0:8000 | |
command: bash -c "pip install -r requirements.txt && gunicorn geninfo.wsgi:application --bind 0.0.0.0:8000" | |
volumes: | |
- .:/usr/src/ | |
expose: |
NewerOlder