Skip to content

Instantly share code, notes, and snippets.

View abhisheksoni27's full-sized avatar

Abhishek Soni abhisheksoni27

View GitHub Profile
@abhisheksoni27
abhisheksoni27 / designer.html
Last active August 29, 2015 14:22
designer
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-input/core-input.html">
<link rel="import" href="../topeka-elements/category-images.html">
<link rel="import" href="../core-icons/av-icons.html">
<link rel="import" href="../paper-fab/paper-fab.html">
<polymer-element name="uiapp">
@abhisheksoni27
abhisheksoni27 / gauss-elim-jordan.md
Last active May 11, 2017 05:28
Gauss Elimination and Gauss Jordan Method

Gauss Elimination

#include <stdio.h>
#include <math.h>

void main()
{
    float temp, s, matrix[3][4], x[3];
function performRegression() {
regressionModel = new SLR(X, y); // Train the model on training data
console.log(regressionModel.toString(3));
predictOutput();
}
const readline = require('readline'); // For user prompt to allow predictions
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
const ml = require('ml-regression');
const csv = require('csvtojson');
const SLR = ml.SLR; // Simple Linear Regression
const csvFilePath = 'advertising.csv'; // Data
let csvData = [], // parsed Data
X = [], // Input
y = []; // Output
let regressionModel;
function predictOutput() {
rl.question('Enter input X for prediction (Press CTRL+C to exit) : ', (answer) => {
console.log(`At X = ${answer}, y = ${regressionModel.predict(parseFloat(answer))}`);
predictOutput();
});
}
function dressData() {
/**
* One row of the data object looks like:
* {
* TV: "10",
* Radio: "100",
* Newspaper: "20",
* "Sales": "1000"
* }
*
csv()
.fromFile(csvFilePath)
.on('json', (jsonObj) => {
csvData.push(jsonObj);
})
.on('done', () => {
dressData(); // To get data points from JSON Objects
performRegression();
});
const ml = require('ml-regression');
const csv = require('csvtojson');
const SLR = ml.SLR; // Simple Linear Regression
const csvFilePath = 'advertising.csv'; // Data
let csvData = [], // parsed Data
X = [], // Input
y = []; // Output
let regressionModel;