TransMogrifai (Trrannounced Trranced Trranc-m ŏgˈrə-fī)는 Apache Spark 위에 실행되는 Scala로 작성된 Automl 라이브러리입니다. 머신 러닝 자동화를 통한 기계 학습 개발자 생산성을 가속화하는 데 중점을두고 컴파일 타임 타임 안전, 모듈성 및 재사용을 시행하는 API에 중점을 둡니다. 자동화를 통해 거의 100 배의 시간이 줄어든 핸드 튜닝 모델에 가까운 정확도를 달성합니다.
머신 러닝 라이브러리가 필요한 경우 transMogrifai를 사용하십시오.
TransMogrifai의 동기를 이해하려면 다음을 확인하십시오.
빠른 시작 및 문서로 건너 뜁니다.
타이타닉 데이터 세트는 기계 학습 커뮤니티에서 자주 인용되는 데이터 세트입니다. 목표는 타이타닉 여객 매니페스트에서 생존자를 예측할 기계 학습 모델을 구축하는 것입니다. TransMogrifai를 사용하여 모델을 구축하는 방법은 다음과 같습니다.
import com . salesforce . op . _
import com . salesforce . op . readers . _
import com . salesforce . op . features . _
import com . salesforce . op . features . types . _
import com . salesforce . op . stages . impl . classification . _
import org . apache . spark . SparkConf
import org . apache . spark . sql . SparkSession
implicit val spark = SparkSession .builder.config( new SparkConf ()).getOrCreate()
import spark . implicits . _
// Read Titanic data as a DataFrame
val passengersData = DataReaders . Simple .csvCase[ Passenger ](path = pathToData).readDataset().toDF()
// Extract response and predictor Features
val (survived, predictors) = FeatureBuilder .fromDataFrame[ RealNN ](passengersData, response = " survived " )
// Automated feature engineering
val featureVector = predictors.transmogrify()
// Automated feature validation and selection
val checkedFeatures = survived.sanityCheck(featureVector, removeBadFeatures = true )
// Automated model selection
val pred = BinaryClassificationModelSelector ().setInput(survived, checkedFeatures).getOutput()
// Setting up a TransmogrifAI workflow and training the model
val model = new OpWorkflow ().setInputDataset(passengersData).setResultFeatures(pred).train()
println( " Model summary: n " + model.summaryPretty())모델 요약 :
Evaluated Logistic Regression, Random Forest models with 3 folds and AuPR metric.
Evaluated 3 Logistic Regression models with AuPR between [0.6751930383321765, 0.7768725281794376]
Evaluated 16 Random Forest models with AuPR between [0.7781671467343991, 0.8104798040316159]
Selected model Random Forest classifier with parameters:
|-----------------------|--------------|
| Model Param | Value |
|-----------------------|--------------|
| modelType | RandomForest |
| featureSubsetStrategy | auto |
| impurity | gini |
| maxBins | 32 |
| maxDepth | 12 |
| minInfoGain | 0.001 |
| minInstancesPerNode | 10 |
| numTrees | 50 |
| subsamplingRate | 1.0 |
|-----------------------|--------------|
Model evaluation metrics:
|-------------|--------------------|---------------------|
| Metric Name | Hold Out Set Value | Training Set Value |
|-------------|--------------------|---------------------|
| Precision | 0.85 | 0.773851590106007 |
| Recall | 0.6538461538461539 | 0.6930379746835443 |
| F1 | 0.7391304347826088 | 0.7312186978297163 |
| AuROC | 0.8821603927986905 | 0.8766642291593114 |
| AuPR | 0.8225075757571668 | 0.850331080886535 |
| Error | 0.1643835616438356 | 0.19682151589242053 |
| TP | 17.0 | 219.0 |
| TN | 44.0 | 438.0 |
| FP | 3.0 | 64.0 |
| FN | 9.0 | 97.0 |
|-------------|--------------------|---------------------|
Top model insights computed using correlation:
|-----------------------|----------------------|
| Top Positive Insights | Correlation |
|-----------------------|----------------------|
| sex = "female" | 0.5177801026737666 |
| cabin = "OTHER" | 0.3331391338844782 |
| pClass = 1 | 0.3059642953159715 |
|-----------------------|----------------------|
| Top Negative Insights | Correlation |
|-----------------------|----------------------|
| sex = "male" | -0.5100301587292186 |
| pClass = 3 | -0.5075774968534326 |
| cabin = null | -0.31463114463832633 |
|-----------------------|----------------------|
Top model insights computed using CramersV:
|-----------------------|----------------------|
| Top Insights | CramersV |
|-----------------------|----------------------|
| sex | 0.525557139885501 |
| embarked | 0.31582347194683386 |
| age | 0.21582347194683386 |
|-----------------------|----------------------|
더 많은 제어를 원하는 사람들에게는 너무 마법처럼 보일 수 있지만, TransMogrifai는 추출되는 모든 기능과 ML 파이프 라인에 적용되는 모든 알고리즘을 완전히 지정할 수있는 유연성을 제공합니다. 전체 문서, 시작, 예제, FAQ 및 기타 정보를 보려면 문서 사이트를 방문하십시오.
기존 프로젝트에 정기적 인 종속성으로 TransMogrifai를 추가 할 수 있습니다. 아래 버전 매트릭스의 프로젝트 종속성과 일치하도록 TransMogrifai 버전을 선택하여 시작하십시오 (확실하지 않은 경우 - 안정 버전을 가져 가십시오).
| TransMogrifai 버전 | 스파크 버전 | 스칼라 버전 | 자바 버전 |
|---|---|---|---|
| 0.7.1 (미공개, 마스터), 0.7.0 (안정) | 2.4 | 2.11 | 1.8 |
| 0.6.1, 0.6.0, 0.5.3, 0.5.2, 0.5.1, 0.5.0 | 2.3 | 2.11 | 1.8 |
| 0.4.0, 0.3.4 | 2.2 | 2.11 | 1.8 |
build.gradle add의 gradle의 경우 :
repositories {
jcenter()
mavenCentral()
}
dependencies {
// TransmogrifAI core dependency
compile ' com.salesforce.transmogrifai:transmogrifai-core_2.11:0.7.0 '
// TransmogrifAI pretrained models, e.g. OpenNLP POS/NER models etc. (optional)
// compile 'com.salesforce.transmogrifai:transmogrifai-models_2.11:0.7.0'
} build.sbt add의 sbt의 경우 :
scalaVersion : = " 2.11.12 "
resolvers + = Resolver .jcenterRepo
// TransmogrifAI core dependency
libraryDependencies + = " com.salesforce.transmogrifai " %% " transmogrifai-core " % " 0.7.0 "
// TransmogrifAI pretrained models, e.g. OpenNLP POS/NER models etc. (optional)
// libraryDependencies += "com.salesforce.transmogrifai" %% "transmogrifai-models" % "0.7.0"그런 다음 코드로 트랜스 모그리프라이를 가져옵니다.
// TransmogrifAI functionality: feature types, feature builders, feature dsl, readers, aggregators etc.
import com . salesforce . op . _
import com . salesforce . op . aggregators . _
import com . salesforce . op . features . _
import com . salesforce . op . features . types . _
import com . salesforce . op . readers . _
// Spark enrichments (optional)
import com . salesforce . op . utils . spark . RichDataset . _
import com . salesforce . op . utils . spark . RichRDD . _
import com . salesforce . op . utils . spark . RichRow . _
import com . salesforce . op . utils . spark . RichMetadata . _
import com . salesforce . op . utils . spark . RichStructType . _ 전체 문서, 시작, 예제, FAQ 및 기타 정보를 보려면 문서 사이트를 방문하십시오.
프로그래밍 API는 Scaladoc을 참조하십시오.
BSD 3-Clause © Salesforce.com, Inc.