public static VectorPointBase ToVectorPoint(this KeyFeature data, IEmbeddingModel model, int id) { if (model is Ip2VecModel || model is NeVeModel) { return(new DoubleVectorPoint { TimeTick = DateTime.Parse(data.Timestamp).SecondsTick(), Vector = data.VectorByModel(model), Id = id }); } else if (model is StringEmbeddingModel) { return(new StringVectorPoint { TimeTick = DateTime.Parse(data.Timestamp).SecondsTick(), Vector = ((StringEmbeddingModel)model).GetStringVector(data), Id = id }); } else { throw new InvalidCastException(string.Format("Unknown type of {0}", model.GetType())); } }