Skip to content

Instantly share code, notes, and snippets.

View MikeLing's full-sized avatar
:octocat:
Busy

Tiramisu 1993 MikeLing

:octocat:
Busy
View GitHub Profile
@MikeLing
MikeLing / gist:4f6a1c54e9177c8a39b9
Created February 6, 2016 05:23
temporary script trying to query jobs
import sys
from mozci.query_jobs import TreeherderApi
from mozci.errors import TreeherderError
from argparse import ArgumentParser
SUCCESS, WARNING, FAILURE, SKIPPED, EXCEPTION, RETRY, CANCELLED = range(7)
"""This file contains tests for mozci/sources/tc.py."""
import json
from mozci.sources import tc
import unittest
from mock import patch, Mock
from mozhginfo.push import Push
MOCK_REPO_URL = "https://hg.mozilla.org/projects/%(repo_name)s"
MOCK_REVISION = """
{
CKNNSolver(): CDistanceMachine() { init(); }
CKNNSolver::CKNNSolver(int32_t k, float64_t q, int32_t num_classes, int32_t min_label, SGVector<int32_t> train_labels)
: CDistanceMachine()
{
init();
m_k=k;
m_q=q;
m_num_classes=num_classes;
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@MikeLing
MikeLing / Weighted-learning-for-decision-trees.patch
Created March 8, 2017 06:47
Weighted-learning-for-decision-trees.patch
diff --git a/src/mlpack/methods/decision_tree/all_categorical_split.hpp b/src/mlpack/methods/decision_tree/all_categorical_split.hpp
index 23af2c8ca..486320eb1 100644
--- a/src/mlpack/methods/decision_tree/all_categorical_split.hpp
+++ b/src/mlpack/methods/decision_tree/all_categorical_split.hpp
@@ -47,7 +47,7 @@ class AllCategoricalSplit
* @param aux Auxiliary split information, which may be modified on a
* successful split.
*/
- template<typename VecType>
+ template<bool UseWeights, typename VecType, typename WeightVecType>
@MikeLing
MikeLing / orderTheLabels.cpp
Last active March 13, 2017 07:51
fix an issue in mlpack decision tree
#include <iostream>
#include "armadillo"
using namespace arma;
using namespace std;
/*
*This one will output " 3 1 2 9 0 1 8 2 5"
*/
int test1() {
@MikeLing
MikeLing / patch.cc
Last active March 18, 2017 12:42
rewrite test for SVM by Gtest fixture
#include <shogun/classifier/svm/SVMLight.h>
#include <shogun/features/DenseFeatures.h>
#include <shogun/kernel/GaussianKernel.h>
#include <gtest/gtest.h>
#include "../../utils/MockDataForSVM.h"
using namespace shogun;
#ifdef USE_GPL_SHOGUN
#include <shogun/labels/BinaryLabels.h>
#include <shogun/features/DenseFeatures.h>
#include <shogun/features/DataGenerator.h>
using namespace shogun;
class DataGenerator: public ::testing::Environment
{
protected:
virtual ~DataGenerator() {}