mirror of
https://github.com/sjwhitworth/golearn.git
synced 2025-04-26 13:49:14 +08:00
Correct spelling
This commit is contained in:
parent
fc5eafd82b
commit
e5da0a8b04
@ -39,5 +39,5 @@ type Attribute interface {
|
||||
// Tests whether two Attributes can be represented in the same pond
|
||||
// i.e. they're the same size, and their byte order makes them meaningful
|
||||
// when considered together
|
||||
Compatable(Attribute) bool
|
||||
Compatible(Attribute) bool
|
||||
}
|
||||
|
@ -62,9 +62,9 @@ func (b *BinaryAttribute) Equals(other Attribute) bool {
|
||||
}
|
||||
}
|
||||
|
||||
// Compatable checks whether this Attribute can be represented
|
||||
// Compatible checks whether this Attribute can be represented
|
||||
// in the same pond as another.
|
||||
func (b *BinaryAttribute) Compatable(other Attribute) bool {
|
||||
func (b *BinaryAttribute) Compatible(other Attribute) bool {
|
||||
if _, ok := other.(*BinaryAttribute); !ok {
|
||||
return false
|
||||
} else {
|
||||
|
@ -141,9 +141,9 @@ func (Attr *CategoricalAttribute) Equals(other Attribute) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// Compatable checks that this CategoricalAttribute has the same
|
||||
// Compatible checks that this CategoricalAttribute has the same
|
||||
// values as another, in the same order.
|
||||
func (Attr *CategoricalAttribute) Compatable(other Attribute) bool {
|
||||
func (Attr *CategoricalAttribute) Compatible(other Attribute) bool {
|
||||
attribute, ok := other.(*CategoricalAttribute)
|
||||
if !ok {
|
||||
return false
|
||||
|
@ -180,8 +180,8 @@ func (inst *DenseInstances) addAttributeToAttributeGroup(newAttribute Attribute,
|
||||
id := inst.agMap[ag]
|
||||
p := inst.ags[id]
|
||||
for i, a := range p.Attributes() {
|
||||
if !a.Compatable(newAttribute) {
|
||||
return AttributeSpec{-1, 0, nil}, fmt.Errorf("Attribute %s is not compatable with %s in pond '%s' (position %d)", newAttribute, a, ag, i)
|
||||
if !a.Compatible(newAttribute) {
|
||||
return AttributeSpec{-1, 0, nil}, fmt.Errorf("Attribute %s is not Compatible with %s in pond '%s' (position %d)", newAttribute, a, ag, i)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,9 +18,9 @@ func NewFloatAttribute(name string) *FloatAttribute {
|
||||
return &FloatAttribute{name, 2}
|
||||
}
|
||||
|
||||
// Compatable checks whether this FloatAttribute can be ponded with another
|
||||
// Compatible checks whether this FloatAttribute can be ponded with another
|
||||
// Attribute (checks if they're both FloatAttributes)
|
||||
func (Attr *FloatAttribute) Compatable(other Attribute) bool {
|
||||
func (Attr *FloatAttribute) Compatible(other Attribute) bool {
|
||||
_, ok := other.(*FloatAttribute)
|
||||
return ok
|
||||
}
|
||||
|
@ -239,9 +239,9 @@ func SampleWithReplacement(from FixedDataGrid, size int) FixedDataGrid {
|
||||
return NewInstancesViewFromRows(from, rowMap)
|
||||
}
|
||||
|
||||
// CheckCompatable checks whether two DataGrids have the same Attributes
|
||||
// CheckCompatible checks whether two DataGrids have the same Attributes
|
||||
// and if they do, it returns them.
|
||||
func CheckCompatable(s1 FixedDataGrid, s2 FixedDataGrid) []Attribute {
|
||||
func CheckCompatible(s1 FixedDataGrid, s2 FixedDataGrid) []Attribute {
|
||||
s1Attrs := s1.AllAttributes()
|
||||
s2Attrs := s2.AllAttributes()
|
||||
interAttrs := AttributeIntersect(s1Attrs, s2Attrs)
|
||||
|
@ -46,8 +46,8 @@ func (KNN *KNNClassifier) Predict(what base.FixedDataGrid) base.FixedDataGrid {
|
||||
panic("unsupported distance function")
|
||||
|
||||
}
|
||||
// Check compatability
|
||||
allAttrs := base.CheckCompatable(what, KNN.TrainingData)
|
||||
// Check Compatibility
|
||||
allAttrs := base.CheckCompatible(what, KNN.TrainingData)
|
||||
if allAttrs == nil {
|
||||
// Don't have the same Attributes
|
||||
return nil
|
||||
|
Loading…
x
Reference in New Issue
Block a user