Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am andreiz on github.
  • I am andreiz (https://keybase.io/andreiz) on keybase.
  • I have a public key ASAXjXBboFhq4qjHq4l0IxRnFHrOUsXyB-JCIJ0LzMkbEwo

To claim this, I am signing this object:

@andreiz
andreiz / classifier.php
Last active July 12, 2022 12:50
A simple example of logistic regression via gradient descent in PHP.
<?php
error_reporting(E_ALL);
define('NUM_FEATURES', 3);
// My dataset describes cities around the world where I might consider living.
// Each sample (city) consists of 3 features:
// * Feature 1: average low winter temperature in the city
// * Feature 2: city population, in millions
@andreiz
andreiz / facets
Created June 8, 2012 12:43
ElasticSearch {R}evolution talk sample code
curl 'localhost:9200/conf/speaker/_search?pretty=true' -d'
{
"query" : {
"match_all" : {}
},
"size": 0,
"facets" : {
"histo1" : {
"histogram" : {
"field" : "height",
curl -XDELETE 'http://localhost:9200/foo/'
curl -XPUT 'http://localhost:9200/foo/' -d'{ index : { number_of_shards : 1, number_of_replicas : 1 } }'
curl -XPUT 'http://localhost:9200/foo/place/_mapping' -d'
{
"place" : {
"_all" : {"enabled" : false},
"properties" : {
"user_id" : {"type" : "integer", "index" : "not_analyzed"},
"title" : {"type" : "string", "boost" : 1.5},
"notes" : {"type" : "string"},