public byte[] SaveToBytes() { save = false; if (openSee == null) { ResetInfo(); return(null); } return(OpenSeeExpressionRepresentation.ToSerialized(expressions, model, classLabels, indices, pointSelection)); }
public void LoadFromBytes(byte[] data) { load = false; if (openSee == null) { ResetInfo(); return; } OpenSeeExpressionRepresentation.LoadSerialized(data, out expressions, out model, out classLabels, out indices, ref pointSelection); cols = indices.Length; if (model.Ready()) { modelReady = true; } }
static public byte[] ToSerialized(Dictionary <string, List <float[]> > expressions, SVMModel model, string[] classLabels, int[] indices, PointSelection pointSelection) { OpenSeeExpressionRepresentation oser = new OpenSeeExpressionRepresentation(); oser.expressions = expressions; oser.modelBytes = model.SaveModel(); oser.classLabels = classLabels; oser.indices = indices; oser.pointSelection = pointSelection; //oser.newModel = true; IFormatter formatter = new BinaryFormatter(); MemoryStream memoryStream = new MemoryStream(); using (GZipStream gzipStream = new GZipStream(memoryStream, CompressionMode.Compress)) { formatter.Serialize(gzipStream, oser); gzipStream.Flush(); } return(memoryStream.ToArray()); }