- SVM
- ANN/CNN/RNN(LSTM)
- 朴素贝叶斯
- 决策树
- Logist
- KNN
- EM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static std::ostream& operator<<(std::ostream& os, const std::vector<int>& data) | |
{ | |
for (size_t i = 0; i < data.size();i++) | |
{ | |
os << data[i]; | |
if (i < (int)data.size() - 1) | |
{ | |
os << ", "; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
std::string local_to_utf8(const std::string& src) | |
{ | |
#if _WIN32 | |
int len = MultiByteToWideChar(CP_ACP, 0, src.c_str(), -1, NULL, 0); | |
wchar_t* wszUTF16 = new wchar_t[len+1]; | |
memset(wszUTF16, 0, len+1); | |
MultiByteToWideChar(CP_ACP, 0, src.c_str(), -1, wszUTF16, len); | |
len = WideCharToMultiByte(CP_UTF8, 0, wszUTF16, -1, NULL, 0, NULL, NULL); | |
char* szUTF8 = new char[len + 1]; | |
memset(szUTF8, 0, len + 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <vector> | |
#include <string> | |
#include <algorithm> | |
#include <sstream> | |
#include "dirent.h" | |
std::string replace_all(const std::string& str, const std::string& from, const std::string& to) { | |
std::string result_str = str; | |
size_t start_pos = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static const std::string base64_chars = | |
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" | |
"abcdefghijklmnopqrstuvwxyz" | |
"0123456789+/"; | |
static inline bool is_base64(unsigned char c) { | |
return (isalnum(c) || (c == '+') || (c == '/')); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding:utf-8 | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import math | |
def f(x): | |
return x[0] * x[0] + 50 * x[1] * x[1] | |
def g(x): | |
return np.array([2 * x[0], 100 * x[1]]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static std::string strip(const std::string& content) | |
{ | |
if (content.empty()) | |
{ | |
return content; | |
} | |
std::string result = content; | |
while (true) | |
{ | |
const wchar_t last_char = result[result.size() - 1]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <cstring> | |
// FreeType headers | |
#include <ft2build.h> | |
#include FT_FREETYPE_H | |
// OpenCV headers | |
#include <opencv2/core/core.hpp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <fstream> | |
static std::string convertUtf16ToLocal(const unsigned short data) | |
{ | |
char dstData[3]; | |
::wcstombs(dstData, (const wchar_t *)&data, 2); | |
dstData[2] = '\0'; | |
return dstData; | |
} | |
static void dumpUtf16Charset() |