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
from sklearn.ensemble import RandomForestClassifier | |
from sklearn.ensemble import AdaBoostClassifier | |
from sklearn.ensemble import ExtraTreesClassifier, VotingClassifier | |
from xgboost import XGBClassifier | |
rfo = RandomForestClassifier() | |
ada = AdaBoostClassifier() | |
ext = ExtraTreesClassifier() | |
xgb = XGBClassifier() |
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
import scipy.stats as st | |
from sklearn.model_selection import RandomizedSearchCV | |
from xgboost import XGBClassifier | |
# Preconfigure estimator and parameters | |
estimator = XGBClassifier(nthreads=-1) | |
params = { | |
"n_estimators": st.randint(3, 40), | |
"max_depth": st.randint(3, 40), | |
"learning_rate": st.uniform(0.05, 0.4), |
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
def vote(estimators, threshold, X_train, y_train, X_val, y_val, X_test, score_name): | |
predict_list = [] | |
estimator_list = [] | |
for estimator_name in estimators: | |
try: | |
params, val_score, timestamp = get_params(estimator_name) | |
if val_score > threshold: | |
print('Ensemble add %s' % estimator_name) |
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
def all_subs(idx_list): | |
if idx_list == []: | |
return [[]] | |
indices = all_subs(idx_list[1:]) | |
return indices + [[idx_list[0]] + i for i in indices] | |
def search_combination(predict_list, y_val, score_name): | |
idx_list = list(range(len(predict_list))) |
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
import React, { Component } from 'react'; | |
import { Route, Router } from 'react-router-dom'; | |
import createHistory from 'history/createBrowserHistory'; | |
import './App.css'; | |
import Home from './views/Home'; | |
class App extends Component { | |
render() { | |
return ( |
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
import React, { Component } from 'react'; | |
import { Link } from 'react-router-dom'; | |
export default class Home extends Component { | |
render() { | |
return ( | |
<div> | |
<h2>BNK48 Facial Recognition App</h2> | |
<li> | |
<Link to="/photo">Photo Input</Link> |
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
import * as faceapi from 'face-api.js'; | |
// Load models and weights | |
export async function loadModels() { | |
const MODEL_URL = process.env.PUBLIC_URL + '/models'; | |
await faceapi.loadTinyFaceDetectorModel(MODEL_URL); | |
await faceapi.loadFaceLandmarkTinyModel(MODEL_URL); | |
await faceapi.loadFaceRecognitionModel(MODEL_URL); | |
} |
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
import React, { Component } from 'react'; | |
import { withRouter } from 'react-router-dom'; | |
import { loadModels, getFullFaceDescription } from '../api/face'; | |
// Import image to test API | |
const testImg = require('../img/test.jpg'); | |
// Initial State | |
const INIT_STATE = { | |
imageURL: testImg, |
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
import React, { Component } from 'react'; | |
import { Route, Router } from 'react-router-dom'; | |
import createHistory from 'history/createBrowserHistory'; | |
import './App.css'; | |
import Home from './views/Home'; | |
import ImageInput from './views/ImageInput'; | |
class App extends Component { | |
render() { |
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
import React, { Component } from 'react'; | |
import { withRouter } from 'react-router-dom'; | |
import { loadModels, getFullFaceDescription } from '../api/face'; | |
// Import image to test API | |
const testImg = require('../img/test.jpg'); | |
// Initial State | |
const INIT_STATE = { | |
imageURL: testImg, |
OlderNewer