Skip to content

Instantly share code, notes, and snippets.

@deshaion
deshaion / Polynomial_Regression.hpp
Last active March 5, 2021 11:57
Simple Implementation of Polynomial Regression based on Eigen library
template <class T>
class Regression {
private:
Matrix b_eq;
public:
std::vector<double> predict(std::vector<T> &x) {
std::vector<double> y(x.size());
for (int i = 0; i < (int)x.size(); ++i) {
double value = 1;
@deshaion
deshaion / Main.java
Last active November 6, 2015 21:18
Merge files to one qoutations
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) {
@deshaion
deshaion / SCC.txt
Last active August 29, 2015 14:15
Computing strongly connected components
1 4
2 8
3 6
4 7
5 2
6 9
7 1
8 5
8 6
9 7
#include <bits/stdc++.h>
#define S(x) scanf("%d", &x)
#define For(i, x, y) for(int i = x; i < y; ++i)
#define Fill(a, x) memset(a, x, sizeof(a))
void dout() { printf("\n"); }
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {