Skip to content

Instantly share code, notes, and snippets.

@jrzaurin
jrzaurin / train_lightgbm_with_focal_loss.py
Last active August 5, 2020 06:44
How to use custom loss for training lightgbm
focal_loss = lambda x,y: focal_loss_lgb(x, y, alpha=0.25, gamma=1.)
focal_loss_eval = lambda x,y: focal_loss_lgb_eval_error(x, y, alpha=0.25, gamma=1.)
model = lgb.train(best, self.lgtrain, fobj=focal_loss, feval=focal_loss_eval)
@ii-research-yu
ii-research-yu / lightgbm_custom_obj_lambdarank.py
Created June 24, 2019 07:16
lightgbm_custom_obj_lambdarank
def lightgbm_custom_obj_lambdarank(preds, train_data, first_order=False, constant_hessian=1.0):
'''
:param preds: numpy.ndarray of shape (size_data, )
:param train_data:
:return:
'''
all_labels = train_data.get_label() # numpy.ndarray of shape (size_data, )
group = train_data.get_group() # numpy.ndarray of shape (num_queries, )
size_data = len(all_labels)
@mbinna
mbinna / effective_modern_cmake.md
Last active July 16, 2024 05:57
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

@allwefantasy
allwefantasy / autoencoder-sentence-similarity.py
Last active April 28, 2020 02:39
使用自编码器网络实现语句相似度
import tensorflow as tf
import random
import numpy as np
import time
BASIC_HOME = "/Users/allwefantasy/Downloads"
WORD_VECTOR_FILE = BASIC_HOME + '/laiwen/zhuhl_laiwen_word_embedding'
WORD_FILE = BASIC_HOME + '/laiwen/zhuhl_laiwen_keywords2'
WORD_RESULT_VECTOR_FILE = BASIC_HOME + '/laiwen/WORD_RESULT_VECTOR_FILE4'
MODEL_SAVE_DIR = BASIC_HOME + '/laiwen/model/autoencoder'
@mommi84
mommi84 / awesome-kge.md
Last active July 4, 2024 09:07
Awesome Knowledge Graph Embedding Approaches

Awesome Knowledge Graph Embedding Approaches

Awesome

This list contains repositories of libraries and approaches for knowledge graph embeddings, which are vector representations of entities and relations in a multi-relational directed labelled graph. Licensed under CC0.

Libraries

@huming2207
huming2207 / README.md
Last active May 11, 2022 14:10
OpenWrt Chaos Calmer 15.05.1 Linux kernel configuration for SV3-26026

OpenWrt 15.05 Chaos Calmer Linux Kernel Configuration for Seavo SV3-260xx

What it is

This is a Linux Kernel 3.18 configuration for Seavo SV3-260xx series motherboard.

It has:

  • Intel Atom N2600 dual-core CPU
  • Intel GMA3650 (SGX545) GPU
  • Several RS232 serial ports
@gitaarik
gitaarik / git_submodules.md
Last active July 16, 2024 09:42
Git Submodules basic explanation

Git Submodules basic explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of usecases of submodules:

  • Separate big codebases into multiple repositories.
@bwhite
bwhite / rank_metrics.py
Created September 15, 2012 03:23
Ranking Metrics
"""Information Retrieval metrics
Useful Resources:
http://www.cs.utexas.edu/~mooney/ir-course/slides/Evaluation.ppt
http://www.nii.ac.jp/TechReports/05-014E.pdf
http://www.stanford.edu/class/cs276/handouts/EvaluationNew-handout-6-per.pdf
http://hal.archives-ouvertes.fr/docs/00/72/67/60/PDF/07-busa-fekete.pdf
Learning to Rank for Information Retrieval (Tie-Yan Liu)
"""
import numpy as np
@halpo
halpo / 000-instructions.md
Created June 19, 2012 16:40
harvestr R users conference presentation.

Building a beamer presentation with knitr.

Introduction

The documents included are the input for knitr. In addition you need to have the tool pandoc installed. I also use a custom beamer template to add the University of Utah \institute command to the template. It also changes the indentation some.

Steps

  1. knit document with