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 optuna | |
from functools import partial | |
import xgboost as xgb | |
from sklearn.metrics import f1_score | |
def objective(dtrain, dtest, trial): | |
max_depth = trial.suggest_int('max_depth',1,10) | |
eta = trial.suggest_uniform('eta',0.0,1) | |
subsample = trial.suggest_uniform('subsample', 0.5, 1) | |
colsample_bytree = trial.suggest_uniform('colsample_bytree', 0.5, 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
let bottomBorder = CALayer() | |
bottomBorder.frame = CGRect(x: 0, y: view.frame.height - 1, width: view.frame.width, height: 1.0) | |
bottomBorder.backgroundColor = UIColor.lightGray.cgColor | |
view.layer.addSublayer(bottomBorder) |
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 requests | |
from datetime import datetime, timedelta | |
import pandas as pd | |
url = "https://www.google.com/finance/getprices" | |
code = 7203 | |
lsat_date = datetime.now() #データの取得開始日 | |
interval = 86400 #データの間隔(秒)。1日 = 86400秒 | |
market = "TYO" #取引所のコード TYO=東京証券取引所 | |
period = "1Y" #データを取得する期間 |
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
タイポを置換で直す | |
git grep -l 'hogehoge' | xargs sed -i '' -e 's/hogehoge/hugahuga/g' | |
コミットのauthor dateを現在時刻にする | |
git commit --amend --date "`date`" |
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
public final class ReosurcesGetter { | |
public List<File> get(String path, String extension) { | |
File rootFile = new File(getClass().getResource(path).getPath()); | |
return getRecursiveFiles(rootFile, extension); | |
} | |
// ファイルを再帰的に取得 | |
private List<File> getRecursiveFiles(File file, String extension) { | |
Optional<File[]> maybeFiles = Optional.ofNullable(file.listFiles()); | |
List<File> result = new ArrayList<>(); |
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
// httpで | |
"$ref": "http://schema/hogehoge.json" | |
// 絶対パス | |
"$ref": "file:///schema/hogehoge.json" | |
// mavenプロジェクトのresources下の相対パス | |
"$ref": "resource:/schema/hogehoge.json" |
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
\数値で正規表現にマッチした文字列を参照する | |
:%s/hogehoge: \(\"[^\"]*\"\)/hugahuga: \1 | |
改行を挿入する時は\r | |
:%s/\(hogehoge: \"[^\"]*\"\)/\1\r |
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
const fetch = require('node-fetch'); | |
module.exports = ( robot => { | |
robot.respond(/(.*)\s(.*)/, msg => { | |
Promise.all([fetchCurrentStockData(msg.match[2]), fetchDailyStockData(msg.match[2])]).then(values => { | |
const current = values[0] | |
//日次データから最新の前日のデータを取り出す | |
const dailyLatest = values[1][values[1].length - 1] | |
const dailyOneBefore = values[1][values[1].length - 2] | |
const yesterday = dailyLatest['DATE'].getMonth() == current['DATE'].getMonth() |
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
#DataFrameから2次元配列 | |
dataframe.values.toList() | |
#列名で選択 | |
dataframe.loc[:,['A','B']] |
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
//モックを宣言 | |
@Mocked | |
Hoge hoge; | |
//フィールドへの差込み | |
Deencapsulation.setField(hoge, "field" ,"hugahuga"); | |
//メソッドへの差込み | |
when(hoge.get()).thenReturn("hugahuga")); |