id stringlengths 2 7 | text stringlengths 17 51.2k | title stringclasses 1
value |
|---|---|---|
c164700 |
select {
case <-ctx.Done():
return
case <-time.After(time.Second * 15):
}
h.runHealthCheck()
}
}()
return h
} | |
c164701 | access the fields, and not while
// we're querying the storage object.
h.mu.Lock()
h.err = err
h.passed = passed
h.mu.Unlock()
} | |
c164702 | == 1 {
for _, c := range connectors {
// TODO(ericchiang): Make this pass on r.URL.RawQuery and let something latter
// on create the auth request.
http.Redirect(w, r, s.absPath("/auth", c.ID)+"?req="+authReq.ID, http.StatusFound)
return
}
}
connectorInfos := make([]connectorInfo, len(connectors))
... | |
c164703 | return "", fmt.Errorf("failed to update auth request: %v", err)
}
email := claims.Email
if !claims.EmailVerified {
email = email + " (unverified)"
}
s.logger.Infof("login successful: connector %q, username=%q, email=%q, groups=%q",
authReq.ConnectorID, claims.Username, email, claims.Groups)
return path.Jo... | |
c164704 | {
if attr := conn.Prompt(); attr != "" {
return attr
}
return "Username"
} | |
c164705 | value(c.RotateKeysAfter, 6*time.Hour),
value(c.IDTokensValidFor, 24*time.Hour),
))
} | |
c164706 | now = time.Now
}
return &keyCacher{Storage: s, now: now}
} | |
c164707 |
if len(conn.Config) != 0 {
data := []byte(string(conn.Config))
if err := json.Unmarshal(data, connConfig); err != nil {
return c, fmt.Errorf("parse connector config: %v", err)
}
}
c, err := connConfig.Open(conn.ID, logger)
if err != nil {
return c, fmt.Errorf("failed to create connector %s: %v", conn.I... | |
c164708 |
if err != nil {
return Connector{}, fmt.Errorf("failed to open connector: %v", err)
}
}
connector := Connector{
ResourceVersion: conn.ResourceVersion,
Connector: c,
}
s.mu.Lock()
s.connectors[conn.ID] = connector
s.mu.Unlock()
return connector, nil
} | |
c164709 | s.connectors[id]
s.mu.Unlock()
if !ok || storageConnector.ResourceVersion != conn.ResourceVersion {
// Connector object does not exist in server connectors map or
// has been updated in the storage. Need to get latest.
conn, err := s.OpenConnector(storageConnector)
if err != nil {
return Connector{}, fmt... | |
c164710 | c.Host,
c.AdminUsername,
c.AdminPassword,
logger}, nil
} | |
c164711 | "" {
return nil, errors.New("invalid connector config: Host name field required for a root certificate file")
}
g.rootCA = c.RootCA
var err error
if g.httpClient, err = newHTTPClient(g.rootCA); err != nil {
return nil, fmt.Errorf("failed to create HTTP client: %v", err)
}
}
g.loadAllGroups = c.Load... | |
c164712 | http.ProxyFromEnvironment,
DialContext: (&net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
DualStack: true,
}).DialContext,
MaxIdleConns: 100,
IdleConnTimeout: 90 * time.Second,
TLSHandshakeTimeout: 10 * time.Second,
ExpectContinueTimeout: 1 * time.Se... | |
c164713 | return c.teamsForOrg(ctx, client, c.org)
} else if groupScope && c.loadAllGroups {
return c.userGroups(ctx, client)
}
return nil, nil
} | |
c164714 | fmt.Sprintf("%s:%s", org, team)
} | |
c164715 | nil, fmt.Errorf("github: get orgs: %v", err)
}
for _, o := range orgs {
groups = append(groups, o.Login)
}
if apiURL == "" {
break
}
}
return groups, nil
} | |
c164716 | return nil, fmt.Errorf("github: get teams: %v", err)
}
for _, t := range teams {
groups[t.Org.Login] = append(groups[t.Org.Login], c.teamGroupClaims(t)...)
}
if apiURL == "" {
break
}
}
return groups, nil
} | |
c164717 | }
}
for _, team := range userTeams {
if _, ok := teamFilter[team]; ok {
teams = append(teams, team)
}
}
return
} | |
c164718 | != nil {
return nil, err
}
return connector.Connector(conn), nil
} | |
c164719 |
connector.PasswordConnector
connector.RefreshConnector
}, error) {
return c.openConnector(logger)
} | |
c164720 | return fmt.Errorf("failed to connect: %v", err)
}
defer conn.Close()
// If bindDN and bindPW are empty this will default to an anonymous bind.
if err := conn.Bind(c.BindDN, c.BindPW); err != nil {
if c.BindDN == "" && c.BindPW == "" {
return fmt.Errorf("ldap: initial anonymous bind failed: %v", err)
}
re... | |
c164721 |
sum = 0.0
for _, s := range scores {
sum += (s - mean) * (s - mean)
}
sum /= float64(len(scores))
variance = sum
return mean, variance
} | |
c164722 | = append(otherRows, inverseFoldMap[j]...)
}
trainData := base.NewInstancesViewFromVisible(data, otherRows, data.AllAttributes())
// Train
err := cls.Fit(trainData)
if err != nil {
return nil, err
}
// Predict
pred, err := cls.Predict(testData)
if err != nil {
return nil, err
}
// Evaluate
... | |
c164723 | a := range b.attributes {
ret[i] = a
}
return ret
} | |
c164724 | = append(b.attributes, a)
return nil
} | |
c164725 |
ret := &RandomForest{
base.BaseClassifier{},
forestSize,
features,
nil,
}
return ret
} | |
c164726 |
))
}
f.Model = new(meta.BaggedModel)
f.Model.RandomFeatures = f.Features
for i := 0; i < f.ForestSize; i++ {
tree := trees.NewID3DecisionTree(0.00)
f.Model.AddModel(tree)
}
f.Model.Fit(on)
return nil
} | |
c164727 | (base.FixedDataGrid, error) {
return f.Model.Predict(with)
} | |
c164728 | %s\n)", f.ForestSize, f.Features, f.Model)
} | |
c164729 | := from.Size()
ret := NewDenseInstances()
for _, a := range classAttrs {
ret.AddAttribute(a)
ret.AddClassAttribute(a)
}
ret.Extend(rowCount)
return ret
} | |
c164730 | if a.GetName() == name {
return a
}
}
return nil
} | |
c164731 | := ResolveAttributes(inst, attrs)
inst.MapOverRows(specs, func(vals [][]byte, row int) (bool, error) {
index := UnpackBytesToFloat(vals[0])
if index > 0.5 {
ret[1]++
} else {
ret[0]++
}
return false, nil
})
return ret
} | |
c164732 | rows; i++ {
splitVal := UnpackBytesToFloat(inst.Get(attrSpec, i)) > val
splitVar := "0"
if splitVal {
splitVar = "1"
}
classVar := GetClass(inst, i)
if _, ok := ret[splitVar]; !ok {
ret[splitVar] = make(map[string]int)
i--
continue
}
ret[splitVar][classVar]++
}
return ret
} | |
c164733 | panic(fmt.Sprintf("Invalid attribute %s (%s)", at, err))
}
_, rows := inst.Size()
for i := 0; i < rows; i++ {
splitVar := at.GetStringFromSysVal(inst.Get(attrSpec, i))
classVar := GetClass(inst, i)
if _, ok := ret[splitVar]; !ok {
ret[splitVar] = make(map[string]int)
i--
continue
}
ret[splitVa... | |
c164734 | rowMap[i] = j
rowMap[j] = i
}
return NewInstancesViewFromRows(from, rowMap)
} | |
c164735 | len(s1Attrs) {
return nil
} else if len(interAttrs) != len(s2Attrs) {
return nil
}
return interAttrs
} | |
c164736 | equivalent Attributes, in the same order
for a := range d1ags {
ag1 := d1ags[a]
ag2 := d2ags[a]
a1 := ag1.Attributes()
a2 := ag2.Attributes()
for i := range a1 {
at1 := a1[i]
at2 := a2[i]
if !at1.Equals(at2) {
return false
}
}
}
return true
} | |
c164737 | make(map[base.Attribute]bool),
false,
d,
},
bins,
make(map[base.Attribute]float64),
make(map[base.Attribute]float64),
}
} | |
c164738 | if val > b.maxVals[attr] {
b.maxVals[attr] = val
}
if val < b.minVals[attr] {
b.minVals[attr] = val
}
}
return true, nil
})
if err != nil {
return fmt.Errorf("Training error: %s", err)
}
b.trained = true
return nil
} | |
c164739 | precision error
delta := float64(maxVal-minVal) / float64(b.bins)
val := float64(af.GetFloatFromSysVal(field))
if val <= minVal {
disc = 0
} else {
disc = int(math.Floor(float64(float64(val-minVal)/delta + 0.0001)))
}
return base.PackU64ToBytes(uint64(disc))
} | |
c164740 | = json.Unmarshal(marshaledAttrRaw, &ret)
if err != nil {
return nil, err
}
return ret, nil
} | |
c164741 | := make([]Attribute, len(attrs))
for i, v := range attrs {
ret[i], err = DeserializeAttribute(v)
if err != nil {
return nil, err
}
}
return ret, nil
} | |
c164742 | nil
}
}
return nil, WrapError(fmt.Errorf("Unable to match %v in %v", deserialized, matchingWith))
} | |
c164743 |
match, err := ReplaceDeserializedAttributeWithVersionFromInstances(a, matchingWith)
if err != nil {
return nil, WrapError(err)
}
ret[i] = match
}
return ret, nil
} | |
c164744 | false,
make(map[AttributeSpec]bool),
0,
make([]Attribute, 0),
make(map[Attribute]string),
0,
0,
0,
}
} | |
c164745 | _ := copyFixedDataGridStructure(of)
return ret
} | |
c164746 | [][]byte, r int) (bool, error) {
for i, c := range v {
ret.Set(specs2[i], r, c)
}
return true, nil
})
return ret
} | |
c164747 | (not created)", r)
}
}
}()
inst.lock.Lock()
defer inst.lock.Unlock()
inst.createAttributeGroup(name, size)
return nil
} | |
c164748 | := make(map[string]AttributeGroup)
for a := range inst.agMap {
ret[a] = inst.ags[inst.agMap[a]]
}
return ret
} | |
c164749 | is not Compatible with %s in pond '%s' (position %d)", newAttribute, a, ag, i)
}
}
p.AddAttribute(newAttribute)
inst.attributes = append(inst.attributes, newAttribute)
return AttributeSpec{id, len(p.Attributes()) - 1, newAttribute}, nil
} | |
c164750 | a := range p.Attributes() {
ret = append(ret, a)
}
}
return ret
} | |
c164751 | if err != nil {
return err
}
inst.lock.Lock()
defer inst.lock.Unlock()
inst.classAttrs[as] = true
return nil
} | |
c164752 | if err != nil {
return err
}
inst.lock.Lock()
defer inst.lock.Unlock()
inst.classAttrs[as] = false
return nil
} | |
c164753 | defer inst.lock.Unlock()
return inst.allClassAttributes()
} | |
c164754 | }
}
// This might result in multiple ClassAttribute groups
// but hopefully nothing too crazy
if classAttribute {
// ag = fmt.Sprintf("CLASS_%s", ag)
}
// Create the ag if it doesn't exist
if agId, ok := inst.agMap[ag]; !ok {
_, generatingBinClass := inst.ags[agId].(*BinaryAttributeGroup)
if ... | |
c164755 | p := inst.ags[as.pond]
rowBuf[j] = p.get(as.position, i)
}
ok, err := mapFunc(rowBuf, i)
if err != nil {
return err
}
if !ok {
break
}
}
return nil
} | |
c164756 | len(inst.AllAttributes()), inst.maxRow
} | |
c164757 | make([]byte, len(v2))
copy(v3, v2)
inst.Set(a, j, v1)
inst.Set(a, i, v3)
}
} | |
c164758 | buffer.WriteString(fmt.Sprintf("%s ", a.attr.GetStringFromSysVal(val)))
}
buffer.WriteString("\n")
}
missingRows := rows - maxRows
if missingRows != 0 {
buffer.WriteString(fmt.Sprintf("\t...\n%d row(s) undisplayed", missingRows))
} else {
buffer.WriteString("All rows displayed")
}
return buffer.String... | |
c164759 | 0),
make([]base.FilteredAttribute, 0),
make(map[base.Attribute]bool),
make(map[base.Attribute]map[uint64]base.Attribute),
}
return ret
} | |
c164760 | "attr": map[string]interface{}{
"precision": f.Precision,
},
})
} | |
c164761 | ok {
f.Precision = int(precision.(float64))
return nil
}
return fmt.Errorf("Precision must be specified")
} | |
c164762 | equal
return false
}
if Attr.GetName() != other.GetName() {
return false
}
return true
} | |
c164763 | {
return nil, err
}
ret := PackFloatToBytes(f)
return ret, nil
} | |
c164764 |
formatString := fmt.Sprintf("%%.%df", Attr.Precision)
return fmt.Sprintf(formatString, f)
} | |
c164765 | := range ret.funcs {
ret.funcs[i] = f
}
for i := 0; i < input; i++ {
ret.funcs[i] = Linear
ret.SetWeight(i+1, i+1, 1.0)
}
return ret
} | |
c164766 | > 0 {
buf.WriteString(fmt.Sprintf("\t(%d %d %.2f)\n", i+1, j+1, v))
}
}
}
for _, v := range n.biases {
biases.WriteString(fmt.Sprintf(" %.2f", v))
}
return fmt.Sprintf("Network(%d, %s, %s)", n.size, biases.String(), buf.String())
} | |
c164767 | break
}
attrIndex := rand.Intn(len(attrs))
attr := attrs[attrIndex]
matched := false
for _, a := range ret {
if a.Equals(attr) {
matched = true
break
}
}
if !matched {
ret = append(ret, attr)
}
}
}
for _, a := range from.AllClassAttributes() {
ret = append(ret, a)
}... | |
c164768 | := b.selectedAttributes[model]
return base.NewInstancesViewFromAttrs(from, selected)
} | |
c164769 | b.generateTrainingAttrs(model, from)
return base.NewInstancesViewFromAttrs(insts, selected)
} | |
c164770 | b.Models = append(b.Models, m)
} | |
c164771 | := b.generateTrainingInstances(model, f)
c.Fit(l)
wait.Done()
}(m, from, i)
}
wait.Wait()
b.fitOn = base.NewStructuralCopy(from)
} | |
c164772 | m))
}
return fmt.Sprintf("BaggedModel(\n%s)", strings.Join(children, "\n\t"))
} | |
c164773 | := mat.NewDense(1, 1, nil)
subVector.Reset()
subVector.MulElem(vectorX, vectorY)
result := mat.Sum(subVector)
return result
} | |
c164774 | 0, err
}
defer f.Close()
return ParseCSVGetRowsFromReader(f)
} | |
c164775 |
defer f.Close()
return ParseCSVEstimateFilePrecisionFromReader(f)
} | |
c164776 | panic(err)
}
defer f.Close()
return ParseCSVGetAttributesFromReader(f, hasHeaders)
} | |
c164777 | panic(err)
}
defer f.Close()
return ParseCSVSniffAttributeNamesFromReader(f, hasHeaders)
} | |
c164778 | f.Close()
return ParseCSVSniffAttributeTypesFromReader(f, hasHeaders)
} | |
c164779 | err
}
defer f.Close()
return ParseCSVToInstancesFromReader(f, hasHeaders)
} | |
c164780 |
return nil, err
}
defer f.Close()
return ParseCSVToTemplatedInstancesFromReader(f, hasHeaders, template)
} | |
c164781 | {
return nil, err
}
defer f.Close()
return ParseCSVToInstancesWithAttributeGroupsFromReader(f, attrGroups, classAttrGroups, attrOverrides, hasHeaders)
} | |
c164782 |
nb.features = 0
nb.trainingInstances = 0
return &nb
} | |
c164783 | a valid cluster map (points appear in more than one cluster)")
} else {
ret[p] = c
}
}
}
return ret, nil
} | |
c164784 | _, err := d.train.GetAttribute(a)
if err != nil {
return fmt.Errorf("invalid attribute")
}
d.attrs[a] = true
return nil
} | |
c164785 | || c1 != c2 {
panic(matrix.ErrShape)
}
result := .0
for i := 0; i < r1; i++ {
for j := 0; j < c1; j++ {
result += math.Abs(vectorX.At(i, j) - vectorY.At(i, j))
}
}
return result
} | |
c164786 | structure
ret := &LazilyFilteredInstances{
f,
src,
attrs,
make(map[Attribute]bool),
unFilteredMap,
}
// Transfer class Attributes
for _, a := range src.AllClassAttributes() {
ret.AddClassAttribute(a)
}
return ret
} | |
c164787 |
if a.New.Equals(target) {
ret.position = i
ret.attr = target
return ret, nil
}
}
return ret, fmt.Errorf("Couldn't resolve %s", target)
} | |
c164788 |
for _, b := range l.attrs {
if a.Equals(b.Old) {
ret = append(ret, b.New)
}
}
}
}
return ret
} | |
c164789 | if l.classAttrs[a] {
ret = append(ret, a)
}
}
return ret
} | |
c164790 | l.unfilteredMap[as.attr] {
return byteSeq
}
newByteSeq := l.filter.Transform(asOld.attr, as.attr, byteSeq)
return newByteSeq
} | |
c164791 | the original
newRowBuf := make([][]byte, len(asv))
return l.src.MapOverRows(oldAsv, func(oldRow [][]byte, oldRowNo int) (bool, error) {
for i, b := range oldRow {
newField := l.filter.Transform(oldAsv[i].attr, asv[i].attr, b)
newRowBuf[i] = newField
}
return mapFunc(newRowBuf, oldRowNo)
})
} | |
c164792 | a.attr))
}
buffer.WriteString("\nData:\n")
for i := 0; i < maxRows; i++ {
buffer.WriteString("\t")
for _, a := range as {
val := l.Get(a, i)
buffer.WriteString(fmt.Sprintf("%s ", a.attr.GetStringFromSysVal(val)))
}
buffer.WriteString("\n")
}
return buffer.String()
} | |
c164793 | for _, a := range consideredAttributes {
if a.Equals(selectedAttribute) {
matched = true
break
}
}
if matched {
continue
}
consideredAttributes = append(consideredAttributes, selectedAttribute)
attrCounter++
}
return r.internalRule.GetSplitRuleFromSelection(consideredAttributes, f)
} | |
c164794 |
nil,
&RandomTreeRuleGenerator{
attrs,
InformationGainRuleGenerator{},
},
}
} | |
c164795 | = InferID3Tree(from, rt.Rule)
return nil
} | |
c164796 | (base.FixedDataGrid, error) {
return rt.Root.Predict(from)
} | |
c164797 | return err
}
defer func() {
writer.Close()
}()
return rt.SaveWithPrefix(writer, "")
} | |
c164798 |
return rt.Root.SaveWithPrefix(writer, prefix)
} | |
c164799 | nil {
return err
}
return rt.LoadWithPrefix(reader, "")
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.