Skip to content

Instantly share code, notes, and snippets.

View nielsuit227's full-sized avatar

Niels Uitterdijk nielsuit227

View GitHub Profile
@nielsuit227
nielsuit227 / SelectBrushPlot
Last active December 3, 2021 17:33
Time Series Plot (leeoniya/uPlot) with brush and selection option
import React, {useEffect, useRef, useState} from 'react';
import { Switch, Flex, Text } from '@chakra-ui/react';
import UplotReact from 'uplot-react';
import { toast } from 'react-toastify';
import 'uplot/dist/uPlot.min.css';
const colors = [
'#007BFF',
'#FFA62B',
@nielsuit227
nielsuit227 / PlotWithBrush.js
Created September 16, 2021 07:50
React & uPlot - Graph with Brush
import React from 'react';
import UplotReact from 'uplot-react';
import 'uplot/dist/uPlot.min.css';
export default function SelectBrushTimeSeries(props) {
let data = [props.data[0], props.data[3]];
let initXmin = props.data[0][0];
let initXmax = props.data[0][Math.max(10, Math.floor(props.data[0].length / 10))];
let series = [{},
@nielsuit227
nielsuit227 / LDA.py
Created April 18, 2019 06:31
Finished
from typing import Union, Iterable
import numpy as np
# Linear Discriminant Analysis.
# Can be used for linear classification or supervised dimension reduction.
# Assumes same class covariances.
# Just binary implementation.
# Saves ordered transformation matrix.
@nielsuit227
nielsuit227 / KDTree.py
Created April 15, 2019 07:09
Class function.
# Python 3.6.5.
# Numpy 1.16.0.
# Matplotlib 3.0.2.
import numpy as np
import matplotlib.pyplot as plt
def sortnode(val):
return val[2]
@nielsuit227
nielsuit227 / DBSCAN.py
Created April 15, 2019 07:08
Class function
import numpy as np
import matplotlib.pyplot as plt
class DBSCAN(object):
def __init__(self, radius=1.0, minpoints=50, tree=None):
# Pass variables
if tree is not None:
self._tree = tree