Versions in this module Expand all Collapse all v0 v0.0.1 Jun 12, 2019 Changes in this version + const BinaryType + const CategoricalType + const Float64Type + const SerializationFormatVersion + var Logger *log.Logger = log.New(os.Stdout, "", 0) + func CheckStrictlyCompatible(s1 FixedDataGrid, s2 FixedDataGrid) bool + func ConvertAllRowsToMat64(attrs []Attribute, f FixedDataGrid) ([]*mat.Dense, error) + func ConvertRowToMat64(attrs []Attribute, f FixedDataGrid, r int) (*mat.Dense, error) + func DecomposeOnAttributeValues(inst FixedDataGrid, at Attribute) map[string]FixedDataGrid + func DecomposeOnNumericAttributeThreshold(inst FixedDataGrid, at Attribute, val float64) map[string]FixedDataGrid + func DescribeError(description string, err error) error + func FormatError(err error, format string, args ...interface{}) error + func GetClass(from DataGrid, row int) string + func GetClassDistribution(inst FixedDataGrid) map[string]int + func GetClassDistributionAfterSplit(inst FixedDataGrid, at Attribute) map[string]map[string]int + func GetClassDistributionAfterThreshold(inst FixedDataGrid, at Attribute, val float64) map[string]map[string]int + func GetClassDistributionByBinaryFloatValue(inst FixedDataGrid) []int + func GetClassDistributionByCategoricalValue(inst FixedDataGrid) []int + func InstancesAreEqual(inst, other FixedDataGrid) bool + func InstancesTrainTestSplit(src FixedDataGrid, prop float64) (FixedDataGrid, FixedDataGrid) + func MarshalAttribute(a Attribute) (map[string]interface{}, error) + func PackFloatToBytes(val float64) []byte + func PackFloatToBytesInline(val float64, ret []byte) + func PackU64ToBytes(val uint64) []byte + func PackU64ToBytesInline(val uint64, ret []byte) + func ParseARFFGetRows(filepath string) (int, error) + func ParseCSVBuildInstancesFromReader(r io.ReadSeeker, attrs []Attribute, hasHeader bool, u UpdatableDataGrid) (err error) + func ParseCSVEstimateFilePrecision(filepath string) (int, error) + func ParseCSVEstimateFilePrecisionFromReader(r io.ReadSeeker) (int, error) + func ParseCSVGetRows(filepath string) (int, error) + func ParseCSVGetRowsFromReader(r io.ReadSeeker) (int, error) + func ParseCSVSniffAttributeNames(filepath string, hasHeaders bool) []string + func ParseCSVSniffAttributeNamesFromReader(r io.ReadSeeker, hasHeaders bool) []string + func ParseDenseARFFBuildInstancesFromReader(r io.Reader, attrs []Attribute, u UpdatableDataGrid) (err error) + func ParseMatchAttributes(attrs, templateAttrs []Attribute) + func SaveEstimatorToGob(path string, e *Estimator) + func SerializeAttribute(attr Attribute) ([]byte, error) + func SerializeInstances(inst FixedDataGrid, f io.Writer) error + func SerializeInstancesToCSV(inst FixedDataGrid, path string) error + func SerializeInstancesToCSVStream(inst FixedDataGrid, f io.Writer) error + func SerializeInstancesToDenseARFF(inst FixedDataGrid, path, relation string) error + func SerializeInstancesToDenseARFFWithAttributes(inst FixedDataGrid, rawAttrs []Attribute, path, relation string) error + func SerializeInstancesToFile(inst FixedDataGrid, path string) error + func SerializeInstancesToTarWriter(inst FixedDataGrid, tw *tar.Writer, prefix string, includeData bool) error + func SerializeInstancesToWriterDenseARFFWithAttributes(w io.Writer, inst FixedDataGrid, rawAttrs []Attribute, relation string) error + func SetClass(at UpdatableDataGrid, row int, class string) + func SetLogger(logger *log.Logger) + func SetLoggerOut(out io.Writer) + func Silent() + func UnpackBytesToFloat(val []byte) float64 + func UnpackBytesToU64(val []byte) uint64 + func WrapError(err error) error + type Attribute interface + Compatible func(Attribute) bool + Equals func(Attribute) bool + GetName func() string + GetStringFromSysVal func([]byte) string + GetSysValFromString func(string) []byte + GetType func() int + SetName func(string) + String func() string + func AttributeDifference(a1, a2 []Attribute) []Attribute + func AttributeDifferenceReferences(a1, a2 []Attribute) []Attribute + func AttributeIntersect(a1, a2 []Attribute) []Attribute + func AttributeIntersectReferences(a1, a2 []Attribute) []Attribute + func CheckCompatible(s1 FixedDataGrid, s2 FixedDataGrid) []Attribute + func DeserializeAttribute(data []byte) (Attribute, error) + func DeserializeAttributes(data []byte) ([]Attribute, error) + func GetAttributeByName(inst FixedDataGrid, name string) Attribute + func NonClassAttributes(d DataGrid) []Attribute + func NonClassFloatAttributes(d DataGrid) []Attribute + func ParseARFFGetAttributes(filepath string) []Attribute + func ParseCSVGetAttributes(filepath string, hasHeaders bool) []Attribute + func ParseCSVGetAttributesFromReader(r io.ReadSeeker, hasHeaders bool) []Attribute + func ParseCSVSniffAttributeTypes(filepath string, hasHeaders bool) []Attribute + func ParseCSVSniffAttributeTypesFromReader(r io.ReadSeeker, hasHeaders bool) []Attribute + func ReplaceDeserializedAttributeWithVersionFromInstances(deserialized Attribute, matchingWith FixedDataGrid) (Attribute, error) + func ReplaceDeserializedAttributesWithVersionsFromInstances(deserialized []Attribute, matchingWith FixedDataGrid) ([]Attribute, error) + type AttributeGroup interface + AddAttribute func(Attribute) error + Attributes func() []Attribute + RowSizeInBytes func() int + Storage func() []byte + String func() string + type AttributeSpec struct + func ResolveAllAttributes(d DataGrid) []AttributeSpec + func ResolveAttributes(d DataGrid, attrs []Attribute) []AttributeSpec + func (a *AttributeSpec) GetAttribute() Attribute + func (a *AttributeSpec) String() string + type BaseClassifier struct + TrainingData *DataGrid + type BaseEstimator struct + Data *mat.Dense + type BaseRegressor struct + Data mat.Dense + Labels []float64 + Name string + type BinaryAttribute struct + Name string + func NewBinaryAttribute(name string) *BinaryAttribute + func (b *BinaryAttribute) Compatible(other Attribute) bool + func (b *BinaryAttribute) Equals(other Attribute) bool + func (b *BinaryAttribute) GetName() string + func (b *BinaryAttribute) GetStringFromSysVal(val []byte) string + func (b *BinaryAttribute) GetSysValFromString(userVal string) []byte + func (b *BinaryAttribute) GetType() int + func (b *BinaryAttribute) MarshalJSON() ([]byte, error) + func (b *BinaryAttribute) SetName(name string) + func (b *BinaryAttribute) String() string + func (b *BinaryAttribute) UnmarshalJSON(data []byte) error + type BinaryAttributeGroup struct + func (b *BinaryAttributeGroup) AddAttribute(a Attribute) error + func (b *BinaryAttributeGroup) Attributes() []Attribute + func (b *BinaryAttributeGroup) RowSizeInBytes() int + func (b *BinaryAttributeGroup) Storage() []byte + func (b *BinaryAttributeGroup) String() string + type CategoricalAttribute struct + Name string + func NewCategoricalAttribute() *CategoricalAttribute + func (Attr *CategoricalAttribute) Compatible(other Attribute) bool + func (Attr *CategoricalAttribute) Equals(other Attribute) bool + func (Attr *CategoricalAttribute) GetName() string + func (Attr *CategoricalAttribute) GetStringFromSysVal(rawVal []byte) string + func (Attr *CategoricalAttribute) GetSysVal(userVal string) []byte + func (Attr *CategoricalAttribute) GetSysValFromString(rawVal string) []byte + func (Attr *CategoricalAttribute) GetType() int + func (Attr *CategoricalAttribute) GetUsrVal(sysVal []byte) string + func (Attr *CategoricalAttribute) GetValues() []string + func (Attr *CategoricalAttribute) MarshalJSON() ([]byte, error) + func (Attr *CategoricalAttribute) SetName(name string) + func (Attr *CategoricalAttribute) String() string + func (Attr *CategoricalAttribute) UnmarshalJSON(data []byte) error + type Classifier interface + Fit func(FixedDataGrid) error + GetMetadata func() ClassifierMetadataV1 + Load func(string) error + LoadWithPrefix func(*ClassifierDeserializer, string) error + Predict func(FixedDataGrid) (FixedDataGrid, error) + Save func(string) error + SaveWithPrefix func(*ClassifierSerializer, string) error + String func() string + type ClassifierDeserializer struct + Metadata *ClassifierMetadataV1 + func ReadSerializedClassifierStub(filePath string) (*ClassifierDeserializer, error) + func (c *ClassifierDeserializer) Close() + func (c *ClassifierDeserializer) GetAttributeForKey(key string) (Attribute, error) + func (c *ClassifierDeserializer) GetAttributesForKey(key string) ([]Attribute, error) + func (c *ClassifierDeserializer) GetBytesForKey(key string) ([]byte, error) + func (c *ClassifierDeserializer) GetInstancesForKey(key string) (FixedDataGrid, error) + func (c *ClassifierDeserializer) GetJSONForKey(key string, v interface{}) error + func (c *ClassifierDeserializer) GetStringForKey(key string) (string, error) + func (c *ClassifierDeserializer) GetU64ForKey(key string) (uint64, error) + func (c *ClassifierDeserializer) Prefix(prefix string, suffix string) string + func (c *ClassifierDeserializer) ReadMetadataAtPrefix(prefix string) (ClassifierMetadataV1, error) + type ClassifierMetadataV1 struct + ClassifierMetadata map[string]interface{} + ClassifierName string + ClassifierVersion string + FormatVersion int + type ClassifierSerializer struct + func CreateSerializedClassifierStub(filePath string, metadata ClassifierMetadataV1) (*ClassifierSerializer, error) + func (c *ClassifierSerializer) Close() error + func (c *ClassifierSerializer) Prefix(prefix string, suffix string) string + func (c *ClassifierSerializer) WriteAttributeForKey(key string, a Attribute) error + func (c *ClassifierSerializer) WriteAttributesForKey(key string, attrs []Attribute) error + func (c *ClassifierSerializer) WriteBytesForKey(key string, b []byte) error + func (c *ClassifierSerializer) WriteInstancesForKey(key string, g FixedDataGrid, includeData bool) error + func (c *ClassifierSerializer) WriteJSONForKey(key string, v interface{}) error + func (c *ClassifierSerializer) WriteMetadataAtPrefix(prefix string, metadata ClassifierMetadataV1) error + func (c *ClassifierSerializer) WriteU64ForKey(key string, v uint64) error + type DataGrid interface + AddClassAttribute func(Attribute) error + AllAttributes func() []Attribute + AllClassAttributes func() []Attribute + Get func(AttributeSpec, int) []byte + GetAttribute func(Attribute) (AttributeSpec, error) + MapOverRows func([]AttributeSpec, func([][]byte, int) (bool, error)) error + RemoveClassAttribute func(Attribute) error + type DenseInstances struct + func CopyDenseInstances(template *DenseInstances, templateAttrs []Attribute) *DenseInstances + func DeserializeInstances(f io.ReadSeeker) (ret *DenseInstances, err error) + func DeserializeInstancesFromTarReader(tr *FunctionalTarReader, prefix string) (ret *DenseInstances, err error) + func NewDenseCopy(of FixedDataGrid) *DenseInstances + func NewDenseInstances() *DenseInstances + func NewStructuralCopy(of FixedDataGrid) *DenseInstances + func ParseCSVToInstances(filepath string, hasHeaders bool) (instances *DenseInstances, err error) + func ParseCSVToInstancesFromReader(r io.ReadSeeker, hasHeaders bool) (instances *DenseInstances, err error) + func ParseCSVToInstancesWithAttributeGroups(filepath string, attrGroups, classAttrGroups map[string]string, ...) (instances *DenseInstances, err error) + func ParseCSVToInstancesWithAttributeGroupsFromReader(r io.ReadSeeker, attrGroups, classAttrGroups map[string]string, ...) (instances *DenseInstances, err error) + func ParseCSVToTemplatedInstances(filepath string, hasHeaders bool, template *DenseInstances) (instances *DenseInstances, err error) + func ParseCSVToTemplatedInstancesFromReader(r io.ReadSeeker, hasHeaders bool, template *DenseInstances) (instances *DenseInstances, err error) + func ParseDenseARFFToInstances(filepath string) (ret *DenseInstances, err error) + func (inst *DenseInstances) AddAttribute(a Attribute) AttributeSpec + func (inst *DenseInstances) AddAttributeToAttributeGroup(newAttribute Attribute, ag string) (AttributeSpec, error) + func (inst *DenseInstances) AddClassAttribute(a Attribute) error + func (inst *DenseInstances) AllAttributeGroups() map[string]AttributeGroup + func (inst *DenseInstances) AllAttributes() []Attribute + func (inst *DenseInstances) AllClassAttributes() []Attribute + func (inst *DenseInstances) CreateAttributeGroup(name string, size int) (err error) + func (inst *DenseInstances) Extend(rows int) error + func (inst *DenseInstances) Get(a AttributeSpec, row int) []byte + func (inst *DenseInstances) GetAttribute(get Attribute) (AttributeSpec, error) + func (inst *DenseInstances) GetAttributeGroup(name string) (AttributeGroup, error) + func (inst *DenseInstances) MapOverRows(asv []AttributeSpec, mapFunc func([][]byte, int) (bool, error)) error + func (inst *DenseInstances) RemoveClassAttribute(a Attribute) error + func (inst *DenseInstances) RowString(row int) string + func (inst *DenseInstances) Set(a AttributeSpec, row int, val []byte) + func (inst *DenseInstances) Size() (int, int) + func (inst *DenseInstances) String() string + type Estimator interface + Fit func() + type Filter interface + AddAttribute func(Attribute) error + GetAttributesAfterFiltering func() []FilteredAttribute + String func() string + Train func() error + Transform func(Attribute, Attribute, []byte) []byte + type FilteredAttribute struct + New Attribute + Old Attribute + type FixedAttributeGroup struct + func (f *FixedAttributeGroup) AddAttribute(a Attribute) error + func (f *FixedAttributeGroup) Attributes() []Attribute + func (f *FixedAttributeGroup) RowSizeInBytes() int + func (f *FixedAttributeGroup) Storage() []byte + func (f *FixedAttributeGroup) String() string + type FixedDataGrid interface + RowString func(int) string + Size func() (int, int) + func LazyShuffle(from FixedDataGrid) FixedDataGrid + func LazySort(inst FixedDataGrid, direction SortDirection, attrs []AttributeSpec) (FixedDataGrid, error) + func SampleWithReplacement(from FixedDataGrid, size int) FixedDataGrid + func Shuffle(from FixedDataGrid) FixedDataGrid + func Sort(inst FixedDataGrid, direction SortDirection, attrs []AttributeSpec) (FixedDataGrid, error) + type FloatAttribute struct + Name string + Precision int + func NewFloatAttribute(name string) *FloatAttribute + func (Attr *FloatAttribute) CheckSysValFromString(rawVal string) ([]byte, error) + func (Attr *FloatAttribute) Compatible(other Attribute) bool + func (Attr *FloatAttribute) Equals(other Attribute) bool + func (Attr *FloatAttribute) GetFloatFromSysVal(rawVal []byte) float64 + func (Attr *FloatAttribute) GetName() string + func (Attr *FloatAttribute) GetStringFromSysVal(rawVal []byte) string + func (Attr *FloatAttribute) GetSysValFromString(rawVal string) []byte + func (Attr *FloatAttribute) GetType() int + func (Attr *FloatAttribute) SetName(name string) + func (Attr *FloatAttribute) String() string + func (f *FloatAttribute) MarshalJSON() ([]byte, error) + func (f *FloatAttribute) UnmarshalJSON(data []byte) error + type FunctionalTarReader struct + Regenerate func() *tar.Reader + func NewFunctionalTarReader(regenFunc func() *tar.Reader) *FunctionalTarReader + func (f *FunctionalTarReader) GetNamedFile(name string) ([]byte, error) + type GoLearnError struct + CurrentStack string + Description string + WrappedError error + func (g *GoLearnError) Error() string + type InstancesView struct + func NewInstancesViewFromAttrs(src FixedDataGrid, attrs []Attribute) *InstancesView + func NewInstancesViewFromRows(src FixedDataGrid, rows map[int]int) *InstancesView + func NewInstancesViewFromVisible(src FixedDataGrid, rows []int, attrs []Attribute) *InstancesView + func (v *InstancesView) AddClassAttribute(a Attribute) error + func (v *InstancesView) AllAttributes() []Attribute + func (v *InstancesView) AllClassAttributes() []Attribute + func (v *InstancesView) Get(as AttributeSpec, row int) []byte + func (v *InstancesView) GetAttribute(a Attribute) (AttributeSpec, error) + func (v *InstancesView) MapOverRows(as []AttributeSpec, rowFunc func([][]byte, int) (bool, error)) error + func (v *InstancesView) RemoveClassAttribute(a Attribute) error + func (v *InstancesView) RowString(row int) string + func (v *InstancesView) Size() (int, int) + func (v *InstancesView) String() string + type LazilyFilteredInstances struct + func NewLazilyFilteredInstances(src FixedDataGrid, f Filter) *LazilyFilteredInstances + func (l *LazilyFilteredInstances) AddClassAttribute(cls Attribute) error + func (l *LazilyFilteredInstances) AllAttributes() []Attribute + func (l *LazilyFilteredInstances) AllClassAttributes() []Attribute + func (l *LazilyFilteredInstances) Get(as AttributeSpec, row int) []byte + func (l *LazilyFilteredInstances) GetAttribute(target Attribute) (AttributeSpec, error) + func (l *LazilyFilteredInstances) MapOverRows(asv []AttributeSpec, mapFunc func([][]byte, int) (bool, error)) error + func (l *LazilyFilteredInstances) RemoveClassAttribute(cls Attribute) error + func (l *LazilyFilteredInstances) RowString(row int) string + func (l *LazilyFilteredInstances) Size() (int, int) + func (l *LazilyFilteredInstances) String() string + type Mat64Instances struct + Data *mat.Dense + func InstancesFromMat64(rows, cols int, data *mat.Dense) *Mat64Instances + func (m *Mat64Instances) AddClassAttribute(a Attribute) error + func (m *Mat64Instances) AllAttributes() []Attribute + func (m *Mat64Instances) AllClassAttributes() []Attribute + func (m *Mat64Instances) Get(as AttributeSpec, row int) []byte + func (m *Mat64Instances) GetAttribute(a Attribute) (AttributeSpec, error) + func (m *Mat64Instances) MapOverRows(as []AttributeSpec, f func([][]byte, int) (bool, error)) error + func (m *Mat64Instances) RemoveClassAttribute(a Attribute) error + func (m *Mat64Instances) RowString(row int) string + func (m *Mat64Instances) Size() (int, int) + func (m *Mat64Instances) String() string + type Model interface + Score func() + type Predictor interface + Predict func() + type SortDirection int + const Ascending + const Descending + type UpdatableDataGrid interface + AddAttribute func(Attribute) AttributeSpec + Extend func(int) error + Set func(AttributeSpec, int, []byte) + func GeneratePredictionVector(from FixedDataGrid) UpdatableDataGrid