Skip to content

Instantly share code, notes, and snippets.

@amrza
amrza / run.py
Last active May 14, 2024 18:55
How to write RTL(Arabic/Persian) text on images in python.
# Tested on Python 3.6.1
# install: pip install --upgrade arabic-reshaper
import arabic_reshaper
# install: pip install python-bidi
from bidi.algorithm import get_display
# install: pip install Pillow
from PIL import ImageFont
@shagunsodhani
shagunsodhani / Learning to Generate Reviews and Discovering Sentiment.md
Last active January 30, 2020 22:27
Notes for "Learning to Generate Reviews and Discovering Sentiment" paper

Learning to Generate Reviews and Discovering Sentiment

Summary

The authors train a character-RNN (using mLSTM units) over Amazon Product Reviews (82 million reviews) and use the char-RNN as the feature extractor for sentiment analysis. These unsupervised features beat state of the art results for the dataset while are outperformed by supervised approaches on other datasets. Most important observation is that the authors find a single neuron (called as the sentiment neuron) which alone achieves a test accuracy of 92.3% thus giving the impression that the sentiment concept has been captured in that single neuron. Switching this neuron on (or off) during the generative process produces positive (or negative) reviews.

Notes

  • The paper aims to evaluate if the low level features captured by char-RNN can support learning of high-level representations.
@shagunsodhani
shagunsodhani / PixelRNN.md
Created October 9, 2016 13:22
Summary of PixelRNN paper

Pixel Recurrent Neural Network

Introduction

  • Problem: Building an expressive, tractable and scalable image model which can be used in downstream tasks like image generation, reconstruction, compression etc.
  • Link to the paper

Model

  • Scan the image, one row at a time and one pixel at a time (within each row).
public class DataTableParameters
{
public List<DataTableColumn> Columns { get; set; }
public int Draw { get; set; }
public int Length { get; set; }
public List<DataOrder> Order { get; set; }
public Search Search { get; set; }
public int Start { get; set; }
@OllieJones
OllieJones / DataTableResultSet.cs
Last active March 3, 2023 22:16
C# code for handling Ajax calls for the DataTables.net client table-rendering plugin.
/// <summary>
/// Resultset to be JSON stringified and set back to client.
/// </summary>
[Serializable]
[SuppressMessage("ReSharper", "InconsistentNaming")]
public class DataTableResultSet
{
/// <summary>Array of records. Each element of the array is itself an array of columns</summary>
public List<List<string>> data = new List<List<string>>();
@yrevar
yrevar / imagenet1000_clsidx_to_labels.txt
Last active May 10, 2024 05:27
text: imagenet 1000 class idx to human readable labels (Fox, E., & Guestrin, C. (n.d.). Coursera Machine Learning Specialization.)
{0: 'tench, Tinca tinca',
1: 'goldfish, Carassius auratus',
2: 'great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias',
3: 'tiger shark, Galeocerdo cuvieri',
4: 'hammerhead, hammerhead shark',
5: 'electric ray, crampfish, numbfish, torpedo',
6: 'stingray',
7: 'cock',
8: 'hen',
9: 'ostrich, Struthio camelus',

GENERAL TODO:

  • The examples are all over the place. They need to be more consistent.
  • Check that x-archive-queue-derive header. I just skimmed it and it doesn't seem right.
  • Investigate getting an "ias3support@archive.org" address for support requests
  • Some of the standard metadata fields are repeatable, some are not. State this in the descriptions.
  • Excellent Hank idea: Quick Start (TL;DR) section to avoid all the gory details
  • Dang, but this damn thing is hard to read. Will that get better when it gets converted to the PHP wrapper? I have my doubts. May need a some quick George love to give tips for better readability.
  • All the other 'foo' (read: green) bits below