/*! For license information please see dll.230.js.LICENSE.txt */
(window.webpackJsonp_name_dll=window.webpackJsonp_name_dll||[]).push([[230],{3430:function(e,t,n){"use strict";n.r(t);var a=n(14),r=n.n(a),i=n(12),o=n.n(i),s=n(10),u=n.n(s),l=n(15),c=n.n(l),f=n(16),d=n.n(f),p=n(8),m=n.n(p),h=n(7),y=n.n(h),g=n(0),T=n.n(g),C=n(1),v=n.n(C),x=n(75),E=n(86),S=n(1100),R=n.n(S),q=n(201),D=n.n(q),M=n(39),V=n.n(M),_=n(138),b=n.n(_),w=n(135),I=n.n(w),P=n(360),k=n.n(P),A=n(203),O=n(204),F=n(390),N=n(1834),j=n(200),z=n(991);function G(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=m()(e);if(t){var r=m()(this).constructor;n=Reflect.construct(a,arguments,r)}else n=a.apply(this,arguments);return d()(this,n)}}function J(e,t){return e?"Classificiation"===t?I()(k()(e.length)):e.length<3?1:I()(e.length/3):1}var X=function(e){c()(n,e);var t=G(n);function n(e){var a;return r()(this,n),a=t.call(this,e),y()(u()(a),"compute",(function(){var e=a.state,t=e.y,n=e.x,r=e.type,i=e.nTrees,o=e.nTry,s=e.impurityMeasure,u=e.scoreThreshold,l=e.maxTreeDepth,c=e.minItemsCount,f=T.a.createElement(N.default,{x:n,y:t,type:r,nTrees:i,nTry:o,impurityMeasure:s,scoreThreshold:u,maxTreeDepth:l,minItemsCount:c,quantitative:a.props.quantitative,data:a.props.data,onPredict:function(e,n){var i=b()(a.props.data,1);if("Classification"===r){var o=a.props.categorical.slice(),s=e.predict(i).map((function(e){return String(e)})),u="pred_forest"+n;i[u]=s,D()(o,u)||o.push(u),u="correct_forest"+n;var l=a.props.data[t];i[u]=s.map((function(e,t){return e===String(l[t])?"Yes":"No"})),D()(o,u)||o.push(u),a.props.onGenerate(a.props.quantitative,o,i)}}});a.props.logAction(j.DATA_EXPLORER_RANDOM_FOREST,{y:t,x:n,type:r,nTrees:i,nTry:o}),a.props.onCreated(f)})),a.state={y:e.categorical[0],x:e.quantitative[0],type:"Classification",nTrees:50,nTry:1,impurityMeasure:"gini",scoreThreshold:.01,maxTreeDepth:20,minItemsCount:50},a}return o()(n,[{key:"render",value:function(){var e=this,t=this.props,n=t.categorical,a=t.quantitative,r=this.state,i=r.x,o=r.y,s=r.type,u=r.nTrees,l=r.nTry;return T.a.createElement(E.default,{style:{fontSize:"14px",maxWidth:600}},T.a.createElement(E.default.Header,{as:"h4"},"Random Forest",T.a.createElement(z.default,{title:"Random Forest",content:"Instead of growing a single decision tree, a random forest as an ensemble method constructs many decision trees at once and returns the average of the predictions (regression case) or the majority vote (classification case) of the individual trees"})),T.a.createElement(E.default.Body,null,T.a.createElement(A.default,{legend:"Type",options:["Classification"],defaultValue:s,onChange:function(t){t!==e.state.type&&e.setState({type:t,y:"Classification"===t?n[0]:a[0],nTry:J(e.state.x,t)})}}),T.a.createElement(A.default,{legend:"Outcome (Y):",options:"Classification"===s?n:a,defaultValue:o,onChange:function(t){return e.setState({y:t})}}),T.a.createElement(A.default,{legend:"Predictors (X):",multi:!0,options:R()(a.concat(n)),defaultValue:i||"",onChange:function(t){e.setState({x:t,nTry:J(t,s)})}}),T.a.createElement(O.default,{legend:"Number of trees",defaultValue:u,inputStyle:{float:"right"},onChange:function(t){return e.setState({nTrees:t})},tooltipPlacement:"top",min:1}),T.a.createElement(O.default,{legend:"# of predictors to check at each split",defaultValue:l,inputStyle:{float:"right"},onChange:function(t){return e.setState({nTry:t})},tooltipPlacement:"top",min:1,max:V()(i)?i.length:1}),T.a.createElement(F.default,{header:"Change tree features...",headerStyle:{fontSize:"1rem"}},T.a.createElement(O.default,{legend:"Score threshold for split",min:0,max:1,step:.001,defaultValue:this.state.scoreThreshold,onChange:function(t){return e.setState({scoreThreshold:t})}}),T.a.createElement(O.default,{legend:"Maximum tree depth",min:1,max:50,defaultValue:this.state.maxTreeDepth,onChange:function(t){return e.setState({maxTreeDepth:t})}}),T.a.createElement(O.default,{legend:"Minimum # of observations in leaf nodes",min:1,defaultValue:this.state.minItemsCount,onChange:function(t){return e.setState({minItemsCount:t})}})),"Classification"===s?T.a.createElement(A.default,{legend:"Impurity Measure",defaultValue:this.state.impurityMeasure,options:["gini","entropy"],onChange:function(t){return e.setState({impurityMeasure:t})}}):null,T.a.createElement(x.default,{disabled:!i||0===i.length,variant:"primary",block:!0,onClick:this.compute},"Calculate")))}}]),n}(g.Component);X.defaultProps={logAction:function(){}},X.propTypes={categorical:v.a.array.isRequired,quantitative:v.a.array.isRequired,data:v.a.object.isRequired,logAction:v.a.func,onGenerate:v.a.func.isRequired,onCreated:v.a.func.isRequired},t.default=X}}]);