Skip to content

Instantly share code, notes, and snippets.

View Eyongkevin's full-sized avatar
💭
Do something today your future self will thank you for.

Eyong Kevin Eyongkevin

💭
Do something today your future self will thank you for.
View GitHub Profile
@Eyongkevin
Eyongkevin / load.py
Last active November 12, 2018 19:02
Load data from txt file
# Load data
def loadDataSet(filename):
"""
load dataset into data-matrix and label-matrix
Parameters
----------
filename : String
File path containing the data
@Eyongkevin
Eyongkevin / linear_regression.py
Last active February 22, 2023 03:58
Python implementation of linear regression base on derived formular
def standRegres(xArr, yArr):
"""
Find weight given the data and the predicted value
Parameters
----------
xArr : List
Our data
yArr: List
@Eyongkevin
Eyongkevin / lwlr.py
Created November 13, 2018 08:43
This implement a linear weighted linear regression method to overcome underfetting in linear regression
def lwlr(testPoint, xArr, yArr, k=0.1):
"""
Generate an estimate for any point in the x space
Parameters
----------
testPoint: float
point in the x space
xArr : List
Our data
@Eyongkevin
Eyongkevin / article_1.jsx
Last active January 6, 2019 05:42
article_list component displaying one article
import React, { Component } from 'react';
export default class Article extends Component {
render() {
return (
<div className='item'>
<div className='image'>
<img src='public/images/articles/LWLR.jpg' />
</div>
<div className='middle aligned content'>
@Eyongkevin
Eyongkevin / articleData.js
Last active January 5, 2019 16:44
This file contain an array of JavaScript objects, each representing a single article
let articleData={
'logo':'public/images/medium.png',
article :[
{
id: 1,
author: 'eyong kevin',
title: 'Linear Regression: How to overcome underfitting with locally Weight Linear Regression(LWLR)',
description: 'Here, we will look at a technique for locally smoothing our estimates to better fit data',
url: 'https://itnext.io/linear-regression-how-to-overcome-underfitting-with-locally-weight-linear-regression-lwlr-e867f0cde4a4',
clapps: 39,
0x6fC70d74Da267f7b551809993A45c9CF487955e5
@Eyongkevin
Eyongkevin / libraryF.sol
Created April 24, 2019 14:36
This is a solidity library with two functions and a struct.
pragma solidity ^0.4.24;
library count{
struct hold{
uint a;
}
function subUint(hold storage s, uint b) public returns(uint){
@Eyongkevin
Eyongkevin / article_tuts.sol
Created April 24, 2019 16:36
This solidity file contain code that uses the library from the file libraryF.sol
pragma solidity ^0.4.24;
import {count} from './libraryF.sol';
contract Math{
using count for count.hold;
using count for uint;
@Eyongkevin
Eyongkevin / sort_5_numbers.cpp
Last active September 28, 2019 12:37
c++ sorting 5 numbers using only if-statements
#include<iostream>
void swap(int& a, int& b){
// Swap 2 numbers using a temporary variable.
int temp;
temp = a;
a = b;
b = temp;
}
int* sort(int a[]){
@Eyongkevin
Eyongkevin / text_wrap.py
Created December 14, 2019 12:29
Split text into line of sub-strings base on the font size and a given maximum width.
def text_wrap(text, font, max_width):
"""Wrap text base on specified width.
This is to enable text of width more than the image width to be display
nicely.
@params:
text: str
text to wrap
font: obj
font of the text