Skip to content

Instantly share code, notes, and snippets.

View ecsplendid's full-sized avatar

Tim Scarfe ecsplendid

View GitHub Profile
@ecsplendid
ecsplendid / mnist_resnet.py
Last active May 19, 2024 10:57
Hinton MNIST example with resnet
// generated with gpt4-o, probably still buggy
// testing what Hinton spoke about here https://youtu.be/tP-4njhyGvo?si=9JCVwyiftFayc6mA&t=857
// i.e. 50% label noise on train
// CNN, ~10^8 params i.e. in overparam regime for MNIST, tried adding regularisation
# Changes made to the original code:
# 1. Replaced the CNN architecture with a ResNet-based model (MNIST_ResNet) for state-of-the-art performance.
# 2. Incorporated advanced data augmentation techniques: RandomResizedCrop, RandomHorizontalFlip, and RandomErasing.
# 3. Added label smoothing to the loss function to prevent overconfidence in the model.
# 4. Ensured compatibility with Apple's M1/M2 chips using MPS.
@ecsplendid
ecsplendid / hinton_cnn.py
Last active May 19, 2024 10:24
Hinton example with CNN and ~10^8 params, validation acc gets to about 30% for me
// generated with gpt4-o, probably still buggy
// testing what Hinton spoke about here https://youtu.be/tP-4njhyGvo?si=9JCVwyiftFayc6mA&t=857
// i.e. 50% label noise on train
// CNN, ~10^8 params i.e. in overparam regime for MNIST, tried adding regularisation
import torch
import torchvision
import torchvision.transforms as transforms
import torch.nn as nn
import torch.optim as optim
// note: gpt4-o generated, probably buggy
import torch
import torch.nn as nn
import torch.optim as optim
from torchvision import datasets, transforms
from torch.utils.data import DataLoader, random_split, TensorDataset
import numpy as np
import matplotlib.pyplot as plt
// generated with gpt4-o probably buggy
import torch
import torch.nn as nn
import torch.optim as optim
from torchvision import datasets, transforms
from torch.utils.data import DataLoader, random_split, TensorDataset
import numpy as np
import matplotlib.pyplot as plt
cd "$1"
current_dir=$(pwd)
filelist="$current_dir/filelist.txt"
output_file="$current_dir/CombinedAudio.w64"
log_file="$current_dir/ffmpeg_log.txt"
rm -f "$filelist"
rm -f "$log_file"
find "$current_dir" -maxdepth 1 -name 'MixPre-*.WAV' -print0 | sort -z | xargs -0 -I {} echo "file '{}'" >> "$filelist"
echo "Concatenating files... See $log_file for details."
@ecsplendid
ecsplendid / AWSPolly.cs
Created December 13, 2022 18:06
To save you the hours of pain and misery, here is some C# code which you can use to call the AWS Polly service, without having to use AWS's bloat-central SDK. You are welcome :)
using System;
using System.IO;
using System.Net.Http;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
public class PollyService
{
@ecsplendid
ecsplendid / Model summary
Last active April 23, 2019 02:45
Use of 1D convolution across overlapping sliding windows of trading data. There is a time-dependency in the data which I want to accentuate
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
conv1d_1 (Conv1D) (None, 33, 50) 25050
_________________________________________________________________
max_pooling1d_1 (MaxPooling1 (None, 6, 50) 0
_________________________________________________________________
lstm_1 (LSTM) (None, 30) 9720
_________________________________________________________________
dense_1 (Dense) (None, 200) 6200
@ecsplendid
ecsplendid / designer.html
Last active August 29, 2015 14:20
designer
<link rel="import" href="../paper-checkbox/paper-checkbox.html">
<link rel="import" href="../paper-calculator/paper-calculator.html">
<link rel="import" href="../paper-slider/paper-slider.html">
<link rel="import" href="../paper-tabs/paper-tabs.html">
<link rel="import" href="../paper-tabs/paper-tab.html">
<link rel="import" href="../topeka-elements/theme.html">
<link rel="import" href="../topeka-elements/topeka-resources.html">
<link rel="import" href="../topeka-elements/topeka-categories.html">
<polymer-element name="my-element">
function [mean_indexplacementconfidence, worst_indexplacementconfidence, track_indexconfidences, track_placementconfidence, track_placementconfidenceavg] = ...
find_posterior( SC, M, eta, draw_figs, output_width )
%load in a test song cost matrix
%load ws2
%M = 22; % how many tracks to find
[T,W] = size(SC); % tiles and maximum track width
%eta = 1e2; %learning rate