Skip to content

Instantly share code, notes, and snippets.

View marcelcaraciolo's full-sized avatar
💭
Coding !

Marcel Caraciolo marcelcaraciolo

💭
Coding !
View GitHub Profile
#-*- 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."
@marcelcaraciolo
marcelcaraciolo / WA_CRAWLER_V1.py
Last active July 25, 2023 10:00
Scrapper from World Athletics Marathon World Rankings from Men and Women (2019-2023)
import json
import re
import grequests
import pandas as pd
import requests
from bs4 import BeautifulSoup
from bs4.diagnose import profile
@marcelcaraciolo
marcelcaraciolo / aula-06-exercicio-visualizacao.ipynb
Created April 20, 2023 01:14
Aula 06 - Exercicio Visualizacao.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@marcelcaraciolo
marcelcaraciolo / mapfeature.py
Created November 15, 2011 00:36
Map Feature
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)
@marcelcaraciolo
marcelcaraciolo / checkdependencies.py
Created September 5, 2022 13:15
check dependencies example
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/"),
@marcelcaraciolo
marcelcaraciolo / sample.tcx
Created August 12, 2022 21:02
Sample Running TCX file
<?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>
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('|')
@marcelcaraciolo
marcelcaraciolo / linregr.py
Created October 28, 2011 03:43
linear regression
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
@marcelcaraciolo
marcelcaraciolo / docker-compose.yml
Created February 15, 2022 14:59
Geninfo Docker-Compose Demo YAML File
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:
@marcelcaraciolo
marcelcaraciolo / log_regression.py
Created November 6, 2011 14:24
log_regression
from numpy import loadtxt, where
from pylab import scatter, show, legend, xlabel, ylabel
#load the dataset
data = loadtxt('ex2data1.txt', delimiter=',')
X = data[:, 0:2]
y = data[:, 2]
pos = where(y == 1)