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
package me.k11i.hoge; | |
import java.util.Arrays; | |
import java.util.EnumMap; | |
import java.util.List; | |
import java.util.Map; | |
import me.k11i.hoge.HtmlCharsetDetector.FiniteStateMachine.State; | |
import static me.k11i.hoge.HtmlCharsetDetector.FiniteStateMachine.State.*; |
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
package org.apache.spark.ml.evaluation | |
import org.apache.commons.math3.util.FastMath | |
import org.apache.spark.ml.param.ParamMap | |
import org.apache.spark.ml.param.shared.{HasLabelCol, HasProbabilityCol} | |
import org.apache.spark.ml.util.{Identifiable, SchemaUtils} | |
import org.apache.spark.mllib.linalg.{Vector, VectorUDT} | |
import org.apache.spark.sql.types.DoubleType | |
import org.apache.spark.sql.{DataFrame, Row} |
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
package org.apache.commons.math3.stat.interval; | |
import org.apache.commons.math3.distribution.FDistribution; | |
import org.apache.commons.math3.exception.NotPositiveException; | |
import org.apache.commons.math3.exception.NotStrictlyPositiveException; | |
import org.apache.commons.math3.exception.NumberIsTooLargeException; | |
import org.apache.commons.math3.exception.OutOfRangeException; | |
/** | |
* numberOfSuccesses が 0 もしくは numberOfTrials と等しい場合でも、 |
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
# Requirements: | |
# pip install statsmodel pandas numpy scipy | |
from statsmodels.stats import proportion as prop | |
def demo(num_clicks, num_impressions): | |
alpha = 0.05 | |
methods = [ |
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 org.apache.commons.math3.stat.interval.*; | |
import java.util.Arrays; | |
import java.util.List; | |
/** | |
* commons-math3 を使って二項比率の信頼区間を求めるデモプログラム。 | |
*/ | |
public class BinomialProportionDemo { | |
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 javax.crypto.SecretKeyFactory; | |
import javax.crypto.spec.PBEKeySpec; | |
import java.security.NoSuchAlgorithmException; | |
import java.security.SecureRandom; | |
import java.security.spec.InvalidKeySpecException; | |
import java.util.Base64; | |
/** | |
* パスワードハッシュのデモ。 | |
*/ |
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 java.io.*; | |
import java.util.Properties; | |
/** | |
* UTF-8 エンコーディングされたプロパティファイルを {@link Properties} クラスで取り扱う。 | |
*/ | |
public class PropertiesWithUtf8 { | |
static Properties loadUtf8Properties(String resourceName) throws IOException { | |
try (InputStream is = PropertiesWithUtf8.class.getResourceAsStream(resourceName); | |
InputStreamReader isr = new InputStreamReader(is, "UTF-8"); |
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 java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.InputStreamReader; | |
import java.util.Locale; | |
import java.util.PropertyResourceBundle; | |
import java.util.ResourceBundle; | |
/** | |
* UTF-8 エンコーディングされたプロパティファイルを {@link ResourceBundle} クラスで取り扱う。 |
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 org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; | |
import java.util.Base64; | |
import java.util.function.Function; | |
/** | |
* Java 8 と Commons Codec の Base64 エンコーディング・デコーディング性能を比較します。 | |
* | |
* 比較対象の Commons Codec と、パフォーマンス測定結果の統計処理のために Commons Math3 が必要になります。 | |
*/ |
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 java.io.PrintStream; | |
import java.util.Base64; | |
/** | |
* Java 8 より導入された java.util.Base64 の利用デモ。 | |
*/ | |
public class Base64Demo { | |
private static final PrintStream o = System.out; | |
public static void main(String[] args) { |
NewerOlder