mirror of
https://github.com/github/semantic.git
synced 2025-01-03 13:02:37 +03:00
Stub in a decorator assigning feature vectors.
This commit is contained in:
parent
d866df0a3d
commit
8fc465c07c
@ -107,6 +107,10 @@ featureVector d bag = sumVectors $ unitDVector . hash <$> bag
|
||||
normalize vec = fmap (/ vmagnitude vec) vec
|
||||
sumVectors = DList.foldr (Vector.zipWith (+)) (Vector.replicate d 0)
|
||||
|
||||
featureVectorDecorator :: (Prologue.Foldable f, Functor f) => (forall b. CofreeF f (Record a) b -> label) -> Int -> Int -> Int -> TermDecorator f a (Vector.Vector Double)
|
||||
featureVectorDecorator getLabel p q d (a :< s) = Vector.replicate d 0
|
||||
|
||||
|
||||
-- | The magnitude of a Euclidean vector, i.e. its distance from the origin.
|
||||
vmagnitude :: Vector.Vector Double -> Double
|
||||
vmagnitude = sqrtDouble . Vector.sum . fmap (** 2)
|
||||
|
Loading…
Reference in New Issue
Block a user