Train.

@param inEvent the in event
480527
protected void train(InstanceContentEvent inEvent) {
		Instance trainInst = inEvent.getInstance();
		for (int i = 0; i < sizeEnsemble; i++) {
			int k = MiscUtils.poisson(1.0, this.random);
			if (k > 0) {
				Instance weightedInst = trainInst.copy();
				weightedInst.setWeight(trainInst.weight() * k);
				InstanceContentEvent instanceContentEvent = new InstanceContentEvent(
						inEvent.getInstanceIndex(), weightedInst, true, false);
				instanceContentEvent.setClassifierIndex(i);
				instanceContentEvent.setEvaluationIndex(inEvent.getEvaluationIndex());	
				trainingStream.put(instanceContentEvent);
			}
		}
	}
1068054
@EventHandler
	public void init(FMLInitializationEvent event)
	{
		if (isClient())
		{
			ClientCommandHandler.instance.registerCommand(new MalisisCommand());
		}

		Registries.processFMLStateEvent(event);
	}
204458
@Override
    public void in() throws Exception {
        if (data == null) {
            throw new ComponentException("Not connected: " + toString());
        }
        Object val = data;
        // fire only if there is a listener
//        if (ens.shouldFire()) {
//            DataflowEvent e = new DataflowEvent(ens.getController(), this, val);
////            DataflowEvent e = new DataflowEvent(ens.getController(), this, access.toObject());
//            ens.fireIn(e);
//            // the value might be altered
//            val = e.getValue();
//        }

//        access.pass((Access) val);
        fa.setFieldValue(val);
    }
1152877
@Override
    public void trainOnInstanceImpl(Instance inst) {
        if (this.reset == true) {
            this.m_numClasses = inst.numClasses();
            double laplace = this.laplaceCorrectionOption.getValue();
            int numAttributes = inst.numAttributes();

            m_probOfClass = new double[m_numClasses];
            Arrays.fill(m_probOfClass, laplace);

            m_classTotals = new double[m_numClasses];
            Arrays.fill(m_classTotals, laplace * numAttributes);

            m_wordTotalForClass = new DoubleVector[m_numClasses];
            for (int i = 0; i< m_numClasses; i++) {
                //Arrays.fill(wordTotal, laplace);
                m_wordTotalForClass[i] = new DoubleVector();
            }
            this.reset = false;
        }
        // Update classifier
        int classIndex = inst.classIndex();
        int classValue = (int) inst.classValue();//value(classIndex);

        double w = inst.weight();
        m_probOfClass[classValue] += w;

        m_classTotals[classValue] += w * totalSize(inst);
        double total = m_classTotals[classValue];

        for (int i = 0; i < inst.numValues(); i++) {
            int index = inst.index(i);
            if (index != classIndex && !inst.isMissing(i)) {
                //m_wordTotalForClass[index][classValue] += w * inst.valueSparse(i);
                double laplaceCorrection = 0.0;
                if (m_wordTotalForClass[classValue].getValue(index)== 0) {
                    laplaceCorrection = this.laplaceCorrectionOption.getValue();
                }
                m_wordTotalForClass[classValue].addToValue(index, w * inst.valueSparse(i) + laplaceCorrection);
            }
        }
    }
791152
@Override
    public final void fireEvent(final GwtEvent<?> event)
    {
        final NFastArrayList<Layer> layers = getChildNodes();

        if (null != layers)
        {
            final int size = layers.size();

            for (int i = size - 1; i >= 0; i--)
            {
                final Layer layer = layers.get(i);

                if (null != layer)
                {
                    layer.fireEvent(event);
                }
            }
        }
    }
1363565
final public void train(StringWrapperIterator i) 
	{
		Set seenTokens = new HashSet();
		while (i.hasNext()) {
			StringWrapper s = (StringWrapper)i.next();
			BagOfTokens bag = asBagOfTokens(i.nextStringWrapper());
			for (Iterator j=bag.tokenIterator(); j.hasNext(); ) {
				Token tokj = (Token)j.next();
				totalTokens++;
				// increment backgroundFrequency counts
				Integer freq = (Integer)backgroundFrequency.get(tokj);
				if (freq==null) backgroundFrequency.put(tokj,ONE); 
				else if (freq==ONE) backgroundFrequency.put(tokj,TWO);
				else if (freq==TWO) backgroundFrequency.put(tokj,THREE);
				else backgroundFrequency.put(tokj, new Integer(freq.intValue()+1));
			}
		}
	}
202293
protected void train() throws Exception {
      Dataset<Sequence> train = loadDataset();
      if (minFeatureCount > 1) {
         train = train.preprocess(PreprocessorList.create(new MinCountFilter(minFeatureCount).asSequenceProcessor()));
      }
      SequenceLabeler labeler = getLearner().train(train);
      POSTagger tagger = new POSTagger(featurizer.get(), labeler);
      tagger.write(model);
   }
819475
public void setListeners(@NonNull Collection<TrainingListener> listeners) {
        this.listeners.clear();
        this.listeners.addAll(listeners);
        if (trainingMaster != null)
            trainingMaster.setListeners(this.listeners);
    }
847544
public final void fireEvent(CalendarEvent evt) {
        if (fireEvents && !batchUpdates) {
            if (MODEL.isLoggable(FINER)) {
                MODEL.finer(getName() + ": fireing event: " + evt); //$NON-NLS-1$
            }

            requireNonNull(evt);
            Event.fireEvent(this, evt);
        }
    }
1059773
function(event, callback) {	
	var args = Array.prototype.slice.call(arguments, 1);

	localnwt.event._eventData = args;

	var customEvt = y.createEvent("UIEvents");
	customEvt.initEvent(event, true, false);
	this._node.dispatchEvent(customEvt);
}
766065
@Override
    public void in() throws Exception {
        if (data == null) {
//             throw new ComponentException("Not connected: " + toString());
            if (log.isLoggable(Level.WARNING)) {
                log.warning("@In not connected : " + toString() + ", using default value.");
            }
            return;
        }
        Object val = data.getValue();
        // fire only if there is a listener
        if (ens.shouldFire()) {
            DataflowEvent e = new DataflowEvent(ens.getController(), this, val);
//            DataflowEvent e = new DataflowEvent(ens.getController(), this, access.toObject());
            ens.fireIn(e);
            // the value might be altered
            val = e.getValue();
        }
        
        // type conversion
        
        if (val != null && field.getType() != val.getClass() && !field.getType().isAssignableFrom(val.getClass())) {
//            // default type conversion fails, we need to convert.
//            // this will use the Conversions SPI.
            val = Conversions.convert(val, field.getType());
        }

//        access.pass((Access) val);
        setFieldValue(val);
    }
1038545
@Override
    public void trainOnInstance(Instance inst) {
        if (!this.isInit) {
            this.isInit = true;
            InstancesHeader instances = new InstancesHeader(dataset);
            this.learner.setModelContext(instances);
            this.learner.prepareForUse();
        }
        if (inst.weight() > 0) {
            inst.setDataset(dataset);
            learner.trainOnInstance(inst);
        }
    }
933592
public void init (int invOid, int invCode, InvocationDirector invDir)
    {
        _invOid = invOid;
        _invCode = invCode;
        _invdir = invDir;
    }
814548
@Override
    public void in() throws Exception {
        if (data == null) {
            throw new ComponentException("Not connected: " + toString());
        }
        Object val = data.getFieldValue();
        // fire only if there is a listener
        if (ens.shouldFire()) {
            DataflowEvent e = new DataflowEvent(ens.getController(), this, val);
////            DataflowEvent e = new DataflowEvent(ens.getController(), this, access.toObject());
            ens.fireIn(e);
//            // the value might be altered
            val = e.getValue();
        }

//        access.pass((Access) val);
        fa.setFieldValue(val);
    }
436994
public void train(StringWrapperIterator i) 
	{
		Set seenTokens = new HashSet();
		while (i.hasNext()) {
			BagOfTokens bag = asBagOfTokens(i.nextStringWrapper());
			seenTokens.clear();
			for (Iterator j=bag.tokenIterator(); j.hasNext(); ) {
				totalTokenCount++;
				Token tokj = (Token)j.next();
				if (!seenTokens.contains(tokj)) {
					seenTokens.add(tokj);
					// increment documentFrequency counts
					Integer df = (Integer)documentFrequency.get(tokj);
					if (df==null) documentFrequency.put(tokj,ONE); 
					else if (df==ONE) documentFrequency.put(tokj,TWO);
					else if (df==TWO) documentFrequency.put(tokj,THREE);
					else documentFrequency.put(tokj, new Integer(df.intValue()+1));
				}
			}
			collectionSize++;
		}
	}
709378
private void invoke(Method method, Object event, InputContext inputContext) throws Exception {
    if (needContext) {
      method.invoke(flowlet, event, inputContext);
    } else {
      method.invoke(flowlet, event);
    }
  }
1138722
public void frameworkEvent(FrameworkEvent frameworkEvent) {
        final String topic = getTopic(frameworkEvent);

        // Bail quickly if the event is one that should be ignored
        if (topic == null) {
            return;
        }

        // Event properties
        Map<String, Object> eventProperties = new HashMap<String, Object>();

        // "event" --> the original event object
        eventProperties.put(EventConstants.EVENT, frameworkEvent);

        // Non-null result from getBundle
        // "bundle.id" --> source bundle id as Long
        // "bundle.symbolicName" --> source bundle's symbolic name
        // "bundle" --> the source bundle object
        Bundle bundle = frameworkEvent.getBundle();
        if (bundle != null) {
            eventProperties.put(EventConstants.BUNDLE_ID, Long.valueOf(bundle.getBundleId()));
            String symbolicName = bundle.getSymbolicName();
            if (symbolicName != null) {
                eventProperties.put(EventConstants.BUNDLE_SYMBOLICNAME, symbolicName);
            }
            eventProperties.put(EventConstants.BUNDLE, bundle);
        }

        // Non-null result from getThrowable
        // "exception.class" --> fully-qualified class name of attached exception
        // "exception.message" --> the message from the attached exception
        // "exception" --> the Throwable associated with the event
        Throwable throwable = frameworkEvent.getThrowable();
        if (throwable != null) {
            eventProperties.put(EventConstants.EXCEPTION_CLASS, throwable.getClass().getName());
            String message = throwable.getMessage();
            if (message != null) {
                eventProperties.put(EventConstants.EXCEPTION_MESSAGE, message);
            }
            eventProperties.put(EventConstants.EXCEPTION, throwable);
        }

        // Construct and fire the event
        Event event = new Event(topic, eventProperties);
        eventAdmin.postEvent(event);
    }