Skip to content

Instantly share code, notes, and snippets.

View oguzserbetci's full-sized avatar

Oguz Serbetci oguzserbetci

View GitHub Profile
@dmmiller612
dmmiller612 / ExampleUsage.java
Last active March 16, 2023 10:12
Spark DL4J Dataframe/Dataset usage
import org.apache.spark.ml.feature.*;
class ExampleUsage {
public void example(){
List<Row> dubs = Lists.newArrayList(
RowFactory.create(1000.0, 1000.0, 1.0),
RowFactory.create(90.0, 90.0, 0.0)
);
DataFrame df = sqlContext.createDataFrame(dubs, createStruct());
@wassname
wassname / keras_weighted_categorical_crossentropy.py
Last active December 19, 2023 18:17
Keras weighted categorical_crossentropy (please read comments for updated version)
"""
A weighted version of categorical_crossentropy for keras (2.0.6). This lets you apply a weight to unbalanced classes.
@url: https://gist.github.com/wassname/ce364fddfc8a025bfab4348cf5de852d
@author: wassname
"""
from keras import backend as K
def weighted_categorical_crossentropy(weights):
"""
A weighted version of keras.objectives.categorical_crossentropy
@pbugnion
pbugnion / ipython_notebook_in_git.md
Last active October 22, 2023 12:25
Keeping IPython notebooks under Git version control

This gist lets you keep IPython notebooks in git repositories. It tells git to ignore prompt numbers and program outputs when checking that a file has changed.

To use the script, follow the instructions given in the script's docstring.

For further details, read this blogpost.

The procedure outlined here is inspired by this answer on Stack Overflow.

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name: