Skip to content

Instantly share code, notes, and snippets.

View cwarny's full-sized avatar

Cedric Warny cwarny

View GitHub Profile
@cwarny
cwarny / accuracy.py
Last active June 14, 2022 23:30
Software 2.0
class Acc:
def __init__(self, ignore_index=1):
self.ignore_index = ignore_index
def __call__(self, pred, tgt):
# both pred and tgt have shape (bs,seq_len)
mask = tgt != self.ignore_index
pred *= mask
tgt *= mask
correct = torch.eq(pred, tgt).all(1).sum()
import Ember from 'ember';
export default Ember.TextField.extend({
keyPress(code) {
console.log(code.key);
}
});
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Twist</title>
<script id="vertex-shader" type="x-shader/x-vertex">
attribute vec4 vPosition;
void main() {
gl_Position = vPosition;
}
@cwarny
cwarny / semantic.md
Created March 30, 2015 15:10
cant-think-of-a-title

Goal is to create a tool to enable users to generate a structured knowledge from unstructured data through interaction with that data via a GUI. Here are the different features we would like to support:

  1. Tagging content
    • This in turn will update a predictive model that will suggest other documents to be tagged similarly (to be later confirmed or rejected by users)
  2. Extracting entities by highlighting bits of text
  3. Defining simple semantic relationships between entities by drag and drop
  4. Defining ontologies (data models), i.e. rules and relationships that we expect among a set of entities
    • This in turn will enable the system to automatically generate inferences, and therefore new insights

In this meeting, I want to focus on 2, 3 and 4.

@cwarny
cwarny / Friend.js
Created March 6, 2015 04:18
Datavis in Processing workshop
var Friend = function(name, id, friends, x, y, theta) {
this.d = 5;
this.name = name;
this.id = id;
this.theta = theta;
this.name = name;
this.pos = new p5.Vector(x, y, 0);
this.mutualFriends = friends;
this.friends = [];
};
@cwarny
cwarny / index.html
Last active December 22, 2015 15:08
Exploring your social graph
<!DOCTYPE html>
<html>
<head>
<title>Social Graph</title>
<script src="http://cloud.github.com/downloads/processing-js/processing-js/processing-1.4.1.min.js"></script>
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
</head>
<body>
<script type="application/processing" data-processing-target="pjs">
@cwarny
cwarny / SharingPatterns.ipynb
Last active December 22, 2015 08:09
Analyzing virality on Twitter
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cwarny
cwarny / index.html
Last active December 22, 2015 07:58
Sharing Patterns
<!DOCTYPE html>
<html>
<head>
<title>Cascade</title>
<script src="http://cloud.github.com/downloads/processing-js/processing-js/processing-1.4.1.min.js"></script>
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
</head>
<body>
<script type="application/processing" data-processing-target="pjs">
@cwarny
cwarny / socialgraph.ipynb
Last active December 21, 2015 18:19
Build social graph from list of names
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cwarny
cwarny / d3.v3.min.js
Last active December 21, 2015 18:08
IAA Facebook Social Graph
d3=function(){function n(n){return null!=n&&!isNaN(n)}function t(n){return n.length}function e(n){for(var t=1;n*t%1;)t*=10;return t}function r(n,t){try{for(var e in t)Object.defineProperty(n.prototype,e,{value:t[e],enumerable:!1})}catch(r){n.prototype=t}}function i(){}function u(){}function a(n,t,e){return function(){var r=e.apply(t,arguments);return r===t?n:r}}function o(){}function c(n){function t(){for(var t,r=e,i=-1,u=r.length;++i<u;)(t=r[i].on)&&t.apply(this,arguments);return n}var e=[],r=new i;return t.on=function(t,i){var u,a=r.get(t);return arguments.length<2?a&&a.on:(a&&(a.on=null,e=e.slice(0,u=e.indexOf(a)).concat(e.slice(u+1)),r.remove(t)),i&&e.push(r.set(t,{on:i})),n)},t}function l(){ua.event.stopPropagation(),ua.event.preventDefault()}function f(){for(var n,t=ua.event;n=t.sourceEvent;)t=n;return t}function s(n,t){function e(){n.on(t,null)}n.on(t,function(){l(),e()},!0),setTimeout(e,0)}function h(n){for(var t=new o,e=0,r=arguments.length;++e<r;)t[arguments[e]]=c(t);return t.of=function(e,r){return