Skip to content

Instantly share code, notes, and snippets.

View digorithm's full-sized avatar
⚒️
Building

Rodrigo Araújo digorithm

⚒️
Building
View GitHub Profile
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package controller;
import dao.PersonDAO;
import java.io.IOException;
import java.io.PrintWriter;
package dao;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import model.Person;
package dao;
import java.sql.Statement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class ConnectionClass {
package model;
public class Person {
public Person() {
}
public String name;
public String phone;
"""
Programa desenvolvido por Rodrigo Araujo.
Materia: Compiladores
Orientador: jose couto
programa: reconhecedor de estrutura de repeticao FOR do java
"""
import re
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.cross_validation import cross_val_score
from sklearn.linear_model import LogisticRegression
"""
Here we solve the problem of predicting if a wine is white or red
"""
reds = pd.read_csv('winequality-red.csv', sep=';')
import javax.swing.JFrame;
import org.math.plot.*;
public class TestGradDescent {
public static void main(String[] args ){
InitialData id = new InitialData();
id.plotData();
GradientDescent gd = new GradientDescent(id);
gd.execute();
public void printConvergence(){
double[] theta0plot2 = new double[iters];
double[] theta1plot2 = new double[iters];
double[] tplot2 = new double[iters];
System.arraycopy(theta0plot, 0, theta0plot2, 0, iters);
System.arraycopy(theta1plot, 0, theta1plot2, 0, iters);
System.arraycopy(tplot, 0, tplot2, 0, iters);
// Plot the convergence of data
public void addTrendLine(Plot2DPanel plot, boolean removePrev){
if (removePrev){
plot.removePlot(trendline);
}
double[] yEnd = new double[initial_data.x.length];
for (int i=0; i<initial_data.x.length; i++)
yEnd[i] = hypothesisFunction(initial_data.x[i]);
trendline = plot.addLinePlot("final", initial_data.x, yEnd);
}
public void execute(){
do {
this.theta1 -= alpha * deriveTheta1();
this.theta0 -= alpha * deriveTheta0();
//used for plotting
tplot[iters] = iters;
theta0plot[iters] = theta0;
theta1plot[iters] = theta1;