// UpdateTrainingSet takes in a new training set (variable x.)
550401
func (k *KNN) UpdateTrainingSet(trainingSet [][]float64, expectedResults []float64) error {
	if len(trainingSet) == 0 || len(expectedResults) == 0 {
		return fmt.Errorf("Error: length of given data is 0! Need data!")
	}
	if len(trainingSet) != len(expectedResults) {
		return fmt.Errorf("Datasets given do not match in length")
	}

	k.trainingSet = trainingSet
	k.expectedResults = expectedResults

	return nil
}
96470
func (p *propertySet) SetTGConstraint(constraint *structs.Constraint, taskGroup string) {
	p.setConstraint(constraint, taskGroup)
}
618101
func NewUpdateGSetCommandBuilder() *UpdateGSetCommandBuilder {
	return &UpdateGSetCommandBuilder{
		protobuf: &rpbRiakDT.DtUpdateReq{
			Op: &rpbRiakDT.DtOp{
				GsetOp: &rpbRiakDT.GSetOp{},
			},
		},
	}
}
6114
func (n *Network) UpdateWeights(out, err *mat.Dense, learnRate float64) {

	if n.origWeights == nil {
		n.origWeights = mat.DenseCopyOf(n.weights)
	}

	// Multiply that by the learning rate
	mulFunc := func(target, source int, v float64) float64 {
		if target == source {
			return v
		}
		if math.Abs(n.origWeights.At(target, source)) > 0.005 {
			return v + learnRate*out.At(source, 0)*err.At(target, 0)
		}
		return 0.00
	}

	// Add that to the weights
	n.weights.Apply(mulFunc, n.weights)
}
1175112
func updateCert(cert *x509.Certificate, parentSignature string, domain, ip, TSName string, valInfo *certificate.ValidationInfo, certmap map[string]certificate.Certificate) {
	id := certificate.SHA256Hash(cert.Raw)

	if storedCert, ok := certmap[id]; !ok {

		certmap[id] = certificate.CertToStored(cert, parentSignature, domain, ip, TSName, valInfo)

	} else {

		parentFound := false

		for _, p := range storedCert.ParentSignature {

			if parentSignature == p {
				parentFound = true
				break
			}
		}

		if !parentFound {
			storedCert.ParentSignature = append(storedCert.ParentSignature, parentSignature)
		}

		if !storedCert.CA {

			if storedCert.ScanTarget != domain {

				log.WithFields(logrus.Fields{
					"domain":       storedCert.ScanTarget,
					"domain_input": domain,
					"certificate":  storedCert.Hashes.SHA256,
				}).Warning("Different domain input")
			}

			//add IP ( single domain may be served by multiple IPs )
			ipFound := false

			for _, i := range storedCert.IPs {
				if ip == i {
					ipFound = true
					break
				}
			}

			if !ipFound {
				storedCert.IPs = append(storedCert.IPs, ip)
			}
		}

		storedCert.ValidationInfo[TSName] = *valInfo

		certmap[id] = storedCert
	}

}
873084
func (s *DescribeTrainingJobInput) SetTrainingJobName(v string) *DescribeTrainingJobInput {
	s.TrainingJobName = &v
	return s
}
645999
func (model *Model) Train(terms []string) {
	for _, term := range terms {
		model.TrainWord(term)
	}
	model.updateSuffixArr()
}
1185026
func (s *TrainingJob) SetTrainingJobArn(v string) *TrainingJob {
	s.TrainingJobArn = &v
	return s
}
1017310
func WithTrainingSet(st []treebank.SentenceTag) TrainerConsOpt {
	f := func(t *Trainer) {
		t.trainingSet = st
	}
	return f
}
360335
func (m *MockStatefulSetInterface) Update(arg0 *v1.StatefulSet) (*v1.StatefulSet, error) {
	ret := m.ctrl.Call(m, "Update", arg0)
	ret0, _ := ret[0].(*v1.StatefulSet)
	ret1, _ := ret[1].(error)
	return ret0, ret1
}
782313
func (t *Trainer) pretrainCheck() error {
	// check
	if t.nn == nil || !t.nn.initialized() {
		return errors.Errorf("DependencyParser not init()'d. Perhaps you forgot to call .Init() somewhere?")
	}

	if len(t.trainingSet) == 0 {
		return errors.Errorf("Cannot train with no training data set")
	}

	return nil
}
1146109
func newStringSet(keys ...string) stringSet {
	ss := make(stringSet, len(keys))
	ss.add(keys...)
	return ss
}
738296
func (s *SchemaAttributeType) SetStringAttributeConstraints(v *StringAttributeConstraintsType) *SchemaAttributeType {
	s.StringAttributeConstraints = v
	return s
}
535918
func (model *Model) TrainQuery(term string) {
	model.Lock()
	if t, ok := model.Data[term]; ok {
		t.Query++
	} else {
		model.Data[term] = &Counts{0, 1}
	}
	model.SuffDivergence++
	update := model.SuffDivergence > model.SuffDivergenceThreshold
	model.Unlock()
	if update {
		model.updateSuffixArr()
	}
}
912381
func (s *MLModel) SetTrainingDataSourceId(v string) *MLModel {
	s.TrainingDataSourceId = &v
	return s
}
1149546
func (s *CreateConfigurationSetInput) SetConfigurationSet(v *ConfigurationSet) *CreateConfigurationSetInput {
	s.ConfigurationSet = v
	return s
}
214108
func NewSet(vs ...interface{}) Set {
	s := &set{make(map[interface{}]struct{})}
	s.Add(vs...)
	return s
}