/// <summary> /// Writes this Range transform to a stream. /// </summary> /// <param name="stream">The stream to write to</param> /// <param name="r">The range to write</param> public static void Write(Stream stream, RangeTransform r) { var savedCulture = Thread.CurrentThread.CurrentCulture; Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; StreamWriter output = new StreamWriter(stream); output.WriteLine(r._length); output.Write(r._inputStart[0].ToString("r")); for (int i = 1; i < r._inputStart.Length; i++) { output.Write(" " + r._inputStart[i].ToString("r")); } output.WriteLine(); output.Write(r._inputScale[0].ToString("r")); for (int i = 1; i < r._inputScale.Length; i++) { output.Write(" " + r._inputScale[i].ToString("r")); } output.WriteLine(); output.WriteLine("{0} {1}", r._outputStart.ToString("r"), r._outputScale.ToString("r")); output.Flush(); Thread.CurrentThread.CurrentCulture = savedCulture; }
/// <summary> /// Writes this Range transform to a file. This will overwrite any previous data in the file. /// </summary> /// <param name="outputFile">The file to write to</param> /// <param name="r">The Range to write</param> public static void Write(string outputFile, RangeTransform r) { FileStream s = File.Open(outputFile, FileMode.Create); try { Write(s, r); } finally { s.Close(); } }
private SupportVectorMachineModel(SupportVectorMachineModel original, Cloner cloner) : base(original, cloner) { // only using a shallow copy here! (gkronber) this.model = original.model; this.rangeTransform = original.rangeTransform; this.allowedInputVariables = (string[])original.allowedInputVariables.Clone(); if (original.classValues != null) this.classValues = (double[])original.classValues.Clone(); }
public SupportVectorMachineModel(svm_model model, RangeTransform rangeTransform, string targetVariable, IEnumerable<string> allowedInputVariables) : base(targetVariable) { this.name = ItemName; this.description = ItemDescription; this.model = model; this.rangeTransform = rangeTransform; this.allowedInputVariables = allowedInputVariables.ToArray(); }
public SupportVectorMachineModel(svm_model model, RangeTransform rangeTransform, string targetVariable, IEnumerable<string> allowedInputVariables, IEnumerable<double> classValues) : this(model, rangeTransform, targetVariable, allowedInputVariables) { this.classValues = classValues.ToArray(); }
/// <summary> /// Writes this Range transform to a stream. /// </summary> /// <param name="stream">The stream to write to</param> /// <param name="r">The range to write</param> public static void Write(Stream stream, RangeTransform r) { var savedCulture = Thread.CurrentThread.CurrentCulture; Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; StreamWriter output = new StreamWriter(stream); output.WriteLine(r._length); output.Write(r._inputStart[0].ToString("r")); for (int i = 1; i < r._inputStart.Length; i++) output.Write(" " + r._inputStart[i].ToString("r")); output.WriteLine(); output.Write(r._inputScale[0].ToString("r")); for (int i = 1; i < r._inputScale.Length; i++) output.Write(" " + r._inputScale[i].ToString("r")); output.WriteLine(); output.WriteLine("{0} {1}", r._outputStart.ToString("r"), r._outputScale.ToString("r")); output.Flush(); Thread.CurrentThread.CurrentCulture = savedCulture; }