Skip to content

Instantly share code, notes, and snippets.

@sanguedemonstro
sanguedemonstro / ContabilizacaoController.cs
Created January 28, 2020 17:15
How to implement an Enterprise Integration Producer component, version 1.0
using Benner.Corporativo.Contabilizacao.Models;
using Benner.Messaging;
using Benner.Messaging.Core;
using Microsoft.AspNetCore.Mvc;
namespace Benner.Corporativo.Contabilizacao.Producer.Controller
{
[Route("api/contabilizacao")]
[ApiController]
public class ContabilizacaoController : MessagingController
@sanguedemonstro
sanguedemonstro / ContabilizacaoConsumer.cs
Created January 28, 2020 17:06
How to implement an Enterprise Integration Consumer component, version 1.0
using Benner.Corporativo.Contabilizacao.Models;
using Benner.Listener;
using System;
namespace Benner.Corporativo.Contabilizacao.Consumer
{
public class ContabilizacaoConsumer : EnterpriseIntegrationConsumerBase
{
public override IEnterpriseIntegrationSettings Settings => new EnterpriseIntegrationSettings()
{
@sanguedemonstro
sanguedemonstro / simple_linear_regression_easy_way_result.txt
Created April 13, 2017 02:36
Utilizando biblioteca scikit-learn para regressão linear simples no Python - resultado
Utilizando biblioteca scikit-learn no python
y = ax + b
a = 1.92 = a inclinação da linha de tendência.
b = -7.39 = o ponto onde a linha de tendência atinge o eixo y.
@sanguedemonstro
sanguedemonstro / simple_linear_regression_easy_way.py
Created April 13, 2017 02:35
Utilizando biblioteca scikit-learn para regressão linear simples no Python
import pandas as pd
from sklearn import linear_model
#carregando dados hipotéticos, para fins didáticos apenas
dataframe = pd.DataFrame()
dataframe['x'] = [5.1, 5.5, 5.9, 6.5, 6.8, 7.6, 8.3, 8.5, 9.1, 9.5] # horas de estudo
dataframe['y'] = [2.0, 2.9, 4.0, 5.9, 6.0, 6.9, 8.0, 9.0, 9.9, 11.0] # pontuaçao alcançada
x_values = dataframe[['x']]
y_values = dataframe[['y']]
@sanguedemonstro
sanguedemonstro / simple_linear_regression_hard_way_result.txt
Created April 13, 2017 02:31
Implementando fórmula da regressão linear simples no C# - resultado
Implementando fórmula manualmente no C#
y = ax + b
a = 1,92 = a inclinação da linha de tendência.
b = -7,39 = o ponto onde a linha de tendência atinge o eixo y.
@sanguedemonstro
sanguedemonstro / simple_linear_regression_hard_way.cs
Created April 13, 2017 02:29
Implementando fórmula da regressão linear simples no C#
static void Main(string[] args)
{
// carregando dados hipotéticos, para fins didáticos apenas
double[] xValues = { 5.1, 5.5, 5.9, 6.5, 6.8, 7.6, 8.3, 8.5, 9.1, 9.5 }; // horas de estudo
double[] yValues = { 2.0, 2.9, 4.0, 5.9, 6.0, 6.9, 8.0, 9.0, 9.9, 11.0 }; // pontuaçao alcançada
// encontrando a média do valor das variáveis independentes (eixo x) e dependentes (eixo y)
double xMedia = 0;
double yMedia = 0;
for (int index = 0; index < xValues.Length; index++)
@sanguedemonstro
sanguedemonstro / deeptraffic_002.js
Created March 28, 2017 16:04
Aprendizado por Reforço - Deep Learning for Self-Driving Cars
// Tentativa-002 - consegui a média de 70.29 mph
// a few things don't have var in front of them - they update already existing variables the game needs
lanesSide = 1;
patchesAhead = 30;
patchesBehind = 8;
trainIterations = 75000;
var num_inputs = (lanesSide * 2 + 1) * (patchesAhead + patchesBehind);
var num_actions = 5;
@sanguedemonstro
sanguedemonstro / deeptraffic_001.js
Created March 28, 2017 00:14
Aprendizado por Reforço
// Tentativa-001 - consegui a média de 54.32 mph com este
// a few things don't have var in front of them - they update already existing variables the game needs
lanesSide = 2;
patchesAhead = 50;
patchesBehind = 10;
trainIterations = 50000;
var num_inputs = (lanesSide * 2 + 1) * (patchesAhead + patchesBehind);
var num_actions = 5;
@sanguedemonstro
sanguedemonstro / singlefileservice.servicehost.svc
Last active August 29, 2015 13:59
single file service - servicehost
<%@ ServiceHost Language="C#" Service="SampleService" Factory="SampleFactory" %>