//attempt to normalize a numaric column public void Normalize(int col, NormalizationMethod method = NormalizationMethod.StandardScore) { //https://docs.microsoft.com/en-us/azure/machine-learning/studio-module-reference/normalize-data //https://en.wikipedia.org/wiki/Normalization_(statistics) //https://en.wikipedia.org/wiki/Feature_scaling switch (method) { case NormalizationMethod.StandardScore: PreformStandardScoreNormalization(col); break; case NormalizationMethod.FeatureScalingStandardization: PreformStandardization(col); break; case NormalizationMethod.FeatureScalingMinMax: PreformMinMaxNormalization(col); break; case NormalizationMethod.FeatureScalingMean: PreformMeanNormalization(col); break; default: throw new Exception("How did you even get here? Please let the monkey that" + "coded this know the following: \"MatrixData<T>.Normalize.default\", along with" + "what you did to cause this error"); } }
protected override object[] GetDropdownItems() { var document = SkylineDataSchema.Document; List <Tuple <string, NormalizationMethod> > normalizationMethods = new List <Tuple <string, NormalizationMethod> > { new Tuple <string, NormalizationMethod>(string.Empty, null) }; normalizationMethods.AddRange(NormalizationMethod.ListNormalizationMethods(document).Select(ToDropdownItem)); normalizationMethods.AddRange(NormalizationMethod.RatioToSurrogate.ListSurrogateNormalizationMethods(document).Select(ToDropdownItem)); // If there are any molecules that have a normalization method that is not in the list, add it to the end. var normalizationMethodValues = new HashSet <NormalizationMethod>(normalizationMethods.Select(tuple => tuple.Item2) .Where(normalizationMethod => null != normalizationMethod)); foreach (var molecule in document.Molecules) { if (molecule.NormalizationMethod != null && normalizationMethodValues.Add(molecule.NormalizationMethod)) { normalizationMethods.Add(ToDropdownItem(molecule.NormalizationMethod)); } } return(normalizationMethods.Cast <object>().ToArray()); }
/// <summary> /// Construct a ResNodeHiden data for build a ResNet /// </summary> /// <param name="size">hidden size</param> /// <param name="normalization">Which normalizatoin to use</param> /// <param name="dropoutRate">dropout rate</param> public ResNodeDenseDef(int size, NormalizationMethod normalization, float dropoutRate = 0) { HiddenSize = size; NormalizationMethod = normalization; DropoutRate = dropoutRate; ParameterNames = new List <string>(); }
private IList <Tuple <string, NormalizationMethod> > GetDropdownItems(SrmDocument document) { List <Tuple <string, NormalizationMethod> > normalizationMethods = new List <Tuple <string, NormalizationMethod> > { new Tuple <string, NormalizationMethod>(string.Empty, null) }; if (null != document) { normalizationMethods.AddRange(NormalizationMethod.ListNormalizationMethods(document).Select(ToDropdownItem)); normalizationMethods.AddRange(NormalizationMethod.RatioToSurrogate.ListSurrogateNormalizationMethods(document).Select(ToDropdownItem)); // If there are any molecules that have a normalization method that is not in the list, add it to the end. var normalizationMethodValues = new HashSet <NormalizationMethod>(normalizationMethods.Select(tuple => tuple.Item2) .Where(normalizationMethod => null != normalizationMethod)); foreach (var molecule in document.Molecules) { if (molecule.NormalizationMethod != null && normalizationMethodValues.Add(molecule.NormalizationMethod)) { normalizationMethods.Add(ToDropdownItem(molecule.NormalizationMethod)); } } } return(normalizationMethods); }
protected override void UpdateSettings() { var groupComparisonDef = GroupComparisonModel.GroupComparisonDef; ReplaceComboItems(comboControlAnnotation, ListReplicateAnnotations(), groupComparisonDef.ControlAnnotation); string[] controlValues = ListControlValues(); ReplaceComboItems(comboControlValue, controlValues, groupComparisonDef.ControlValue ?? string.Empty); var caseValues = new HashSet <string>(controlValues) { string.Empty }; if (null != groupComparisonDef.ControlValue) { caseValues.Remove(groupComparisonDef.ControlValue); } var sortedCaseValues = caseValues.ToArray(); Array.Sort(sortedCaseValues); ReplaceComboItems(comboCaseValue, sortedCaseValues, groupComparisonDef.CaseValue ?? string.Empty); ReplaceComboItems(comboIdentityAnnotation, new[] { string.Empty }.Concat(ListReplicateAnnotations()), groupComparisonDef.IdentityAnnotation); ReplaceComboItems(comboNormalizationMethod, NormalizationMethod.ListNormalizationMethods(GroupComparisonModel.Document, true), groupComparisonDef.NormalizationMethod); tbxConfidenceLevel.Text = groupComparisonDef.ConfidenceLevelTimes100.ToString(CultureInfo.CurrentCulture); radioScopeProtein.Checked = groupComparisonDef.PerProtein; radioScopePeptide.Checked = !groupComparisonDef.PerProtein; }
/// <summary> /// Construct a dense layer data for build /// </summary> /// <param name="size">hidden size</param> /// <param name="normalization">Which normalizatoin to use</param> /// <param name="dropoutRate">dropout rate</param> public LayerDenseDef(int size, NormalizationMethod normalization, LayerDef activationDef, float dropoutRate = 0) { HiddenSize = size; NormalizationMethod = normalization; DropoutRate = dropoutRate; ParameterNames = new List <string>(); Activation = activationDef; }
public double?GetTransitionValue(NormalizationMethod normalizationMethod, PeptideDocNode peptideDocNode, TransitionGroupDocNode transitionGroupDocNode, TransitionDocNode transitionDocNode, TransitionChromInfo transitionChromInfo) { if (!transitionDocNode.IsQuantitative(Document.Settings)) { return(null); } if (transitionChromInfo == null || transitionChromInfo.IsEmpty) { return(null); } if (TryGetDenominator(normalizationMethod, transitionGroupDocNode.LabelType, transitionChromInfo.FileId, out double?denominator)) { return(transitionChromInfo.Area / denominator); } if (normalizationMethod is NormalizationMethod.RatioToLabel ratioToLabel) { if (ratioToLabel.IsotopeLabelTypeName == transitionGroupDocNode.LabelType.Name) { return(null); } if (SimpleRatios) { return(null); } var otherTransitionGroup = FindMatchingTransitionGroup(ratioToLabel, peptideDocNode, transitionGroupDocNode); if (otherTransitionGroup == null) { return(null); } var otherTransition = FindMatchingTransition(transitionGroupDocNode, transitionDocNode, otherTransitionGroup); if (otherTransition == null) { return(null); } if (!otherTransition.IsQuantitative(Document.Settings)) { return(null); } var otherChrominfo = FindMatchingTransitionChromInfo(transitionChromInfo, otherTransition); if (otherChrominfo == null || otherChrominfo.IsEmpty) { return(null); } return(transitionChromInfo.Area / otherChrominfo.Area); } return(null); }
public void NormalizeAll(NormalizationMethod method = NormalizationMethod.StandardScore, bool ignoreDT = false) { for (int col = 0; col < NumberOfColumns; col++) { if (IsValueNumaric(col) | ignoreDT) { Normalize(col, method); } } }
public override int GetHashCode() { unchecked { var hashCode = RegressionWeighting.GetHashCode(); hashCode = (hashCode * 397) ^ RegressionFit.GetHashCode(); hashCode = (hashCode * 397) ^ NormalizationMethod.GetHashCode(); hashCode = (hashCode * 397) ^ MsLevel.GetHashCode(); hashCode = (hashCode * 397) ^ (Units == null ? 0 : Units.GetHashCode()); return(hashCode); } }
public static NormalizeOption FromPersistedName(string name) { if (string.IsNullOrEmpty(name)) { return(FromNormalizationMethod(NormalizationMethod.NONE)); } if (_specialOptions.TryGetValue(name, out Special specialNormalizeOption)) { return(specialNormalizeOption); } return(FromNormalizationMethod(NormalizationMethod.FromName(name))); }
void IXmlSerializable.ReadXml(XmlReader reader) { RegressionWeighting = RegressionWeighting.Parse(reader.GetAttribute(Attr.weighting)); RegressionFit = RegressionFit.Parse(reader.GetAttribute(Attr.fit)); NormalizationMethod = NormalizationMethod.FromName(reader.GetAttribute(Attr.normalization)); MsLevel = reader.GetNullableIntAttribute(Attr.ms_level); Units = reader.GetAttribute(Attr.units); bool empty = reader.IsEmptyElement; reader.Read(); if (!empty) { reader.ReadEndElement(); } }
public double?GetTransitionValue(NormalizationMethod normalizationMethod, PeptideDocNode peptideDocNode, TransitionDocNode transitionDocNode, TransitionChromInfo transitionChromInfo) { if (peptideDocNode == null) { return(null); } var transitionGroupDocNode = (TransitionGroupDocNode)peptideDocNode.FindNode(transitionDocNode.Transition.Group); if (transitionGroupDocNode == null) { return(null); } return(GetTransitionValue(normalizationMethod, peptideDocNode, transitionGroupDocNode, transitionDocNode, transitionChromInfo)); }
public override int GetHashCode() { unchecked { var hashCode = RegressionWeighting.GetHashCode(); hashCode = (hashCode * 397) ^ RegressionFit.GetHashCode(); hashCode = (hashCode * 397) ^ NormalizationMethod.GetHashCode(); hashCode = (hashCode * 397) ^ MsLevel.GetHashCode(); hashCode = (hashCode * 397) ^ (Units == null ? 0 : Units.GetHashCode()); hashCode = (hashCode * 397) ^ LodCalculation.GetHashCode(); hashCode = (hashCode * 397) ^ MaxLoqBias.GetHashCode(); hashCode = (hashCode * 397) ^ MaxLoqCv.GetHashCode(); hashCode = (hashCode * 397) ^ SimpleRatios.GetHashCode(); return(hashCode); } }
private object ParseValue(string value, Type type) { if (string.IsNullOrEmpty(value)) { return(null); } if (type == typeof(SampleType)) { return(SampleType.FromName(value)); } if (type == typeof(NormalizationMethod)) { return(NormalizationMethod.FromName(value)); } return(Convert.ChangeType(value, type, DataSchema.DataSchemaLocalizer.FormatProvider)); }
/// <summary> /// Returns the normalization options that are appropriate for the document. /// Note: never includes "Default", "None", "Total", or "Maximum". /// </summary> /// <param name="document"></param> /// <returns></returns> public static IEnumerable <NormalizeOption> AvailableNormalizeOptions(SrmDocument document) { foreach (var normalizationMethod in NormalizationMethod.ListNormalizationMethods(document) .OrderBy(method => method is NormalizationMethod.RatioToLabel ? 0 : 1)) { if (Equals(normalizationMethod, NormalizationMethod.NONE)) { continue; } yield return(FromNormalizationMethod(normalizationMethod)); } if (document.Settings.PeptideSettings.Quantification.RegressionFit != RegressionFit.NONE) { yield return(CALIBRATED); } }
void IXmlSerializable.ReadXml(XmlReader reader) { RegressionWeighting = RegressionWeighting.Parse(reader.GetAttribute(Attr.weighting)); RegressionFit = RegressionFit.Parse(reader.GetAttribute(Attr.fit)); NormalizationMethod = NormalizationMethod.FromName(reader.GetAttribute(Attr.normalization)); MsLevel = reader.GetNullableIntAttribute(Attr.ms_level); Units = reader.GetAttribute(Attr.units); LodCalculation = LodCalculation.Parse(reader.GetAttribute(Attr.lod_calculation)); MaxLoqBias = reader.GetNullableDoubleAttribute(Attr.max_loq_bias); MaxLoqCv = reader.GetNullableDoubleAttribute(Attr.max_loq_cv); bool empty = reader.IsEmptyElement; reader.Read(); if (!empty) { reader.ReadEndElement(); } }
public static string NormalizeTag(string tag, NormalizationMethod method) { string output = string.Empty; if (!string.IsNullOrEmpty(tag)) { output = tag.Trim().TrimStart('#').Trim(); switch (method) { case NormalizationMethod.NonSpaced: output = NormalizeNonSpaced(output); break; case NormalizationMethod.Spaced: output = NormalizeSpaced(output); break; default: throw new NotImplementedException(); } } return("#" + output); }
public bool TryGetDenominator(NormalizationMethod normalizationMethod, IsotopeLabelType labelType, ChromFileInfoId fileId, out double?denominator) { if (Equals(normalizationMethod, NormalizationMethod.NONE)) { denominator = 1; return(true); } FileInfo fileInfo; if (!_fileInfos.TryGetValue(fileId, out fileInfo)) { denominator = null; return(true); } if (Equals(normalizationMethod, NormalizationMethod.GLOBAL_STANDARDS)) { denominator = fileInfo.GlobalStandardArea; return(true); } if (Equals(normalizationMethod, NormalizationMethod.EQUALIZE_MEDIANS)) { var normalizationData = _normalizationData.Value; var medianAdjustment = normalizationData.GetMedian(fileId, labelType) - normalizationData.GetMedianMedian(fileInfo.SampleType, labelType); if (!medianAdjustment.HasValue) { denominator = null; return(true); } denominator = 1 / Math.Pow(2, medianAdjustment.Value); return(true); } if (normalizationMethod is NormalizationMethod.RatioToSurrogate ratioToSurrogate) { denominator = fileInfo.GetSurrogateStandardArea(ratioToSurrogate); return(true); } denominator = null; return(false); }
public void TestDilutionFactor() { var baseDocument = LoadTestDocument(); baseDocument = ChangeQuantificationSettings(baseDocument, QuantificationSettings.DEFAULT .ChangeNormalizationMethod(NormalizationMethod.GetNormalizationMethod(IsotopeLabelType.heavy)) .ChangeRegressionFit(RegressionFit.LINEAR) .ChangeUnits("ng/mL")); var baseCurveFitter = CalibrationCurveFitter.GetCalibrationCurveFitter(baseDocument.Settings, baseDocument.MoleculeGroups.First(), baseDocument.Molecules.First()); var baseCurve = baseCurveFitter.GetCalibrationCurve(); // Set the dilution factor of each external standard to 2.0, and each unknown to 3.0 var docWithDilutionFactor = baseDocument.ChangeMeasuredResults( baseDocument.MeasuredResults.ChangeChromatograms(baseDocument.MeasuredResults.Chromatograms.Select( chrom => Equals(chrom.SampleType, SampleType.STANDARD) ? chrom.ChangeDilutionFactor(2.0) : chrom.ChangeDilutionFactor(3.0)).ToArray())); var dilutionFactorCurveFitter = CalibrationCurveFitter.GetCalibrationCurveFitter( docWithDilutionFactor.Settings, docWithDilutionFactor.MoleculeGroups.First(), docWithDilutionFactor.Molecules.First()); var dilutionFactorCurve = dilutionFactorCurveFitter.GetCalibrationCurve(); Assert.AreEqual(2.0 * baseCurve.Slope, dilutionFactorCurve.Slope); Assert.AreEqual(baseCurve.Intercept, dilutionFactorCurve.Intercept); for (int replicateIndex = 0; replicateIndex < baseDocument.MeasuredResults.Chromatograms.Count; replicateIndex++) { var sampleType = baseDocument.MeasuredResults.Chromatograms[replicateIndex].SampleType; var baseConcentration = baseCurveFitter.GetCalculatedConcentration(baseCurve, replicateIndex); Assert.IsNotNull(baseConcentration); var dilutionFactorConcentration = dilutionFactorCurveFitter.GetCalculatedConcentration(dilutionFactorCurve, replicateIndex); Assert.IsNotNull(dilutionFactorConcentration); if (Equals(sampleType, SampleType.STANDARD)) { Assert.AreEqual(baseConcentration.Value, dilutionFactorConcentration.Value, epsilon); } else { Assert.AreEqual(1.5 * baseConcentration.Value, dilutionFactorConcentration.Value, epsilon); } } AssertEx.ValidatesAgainstSchema(docWithDilutionFactor); }
public void TestSinglePointExternalCalibrationWithIsConcentration() { const double internalStandardConcentration = 80.0; var srmDocument = LoadTestDocument(); srmDocument = ChangeStandardConcentrationCount(srmDocument, 1); srmDocument = ChangeQuantificationSettings(srmDocument, QuantificationSettings.DEFAULT .ChangeRegressionFit(RegressionFit.LINEAR_THROUGH_ZERO) .ChangeNormalizationMethod(NormalizationMethod.GetNormalizationMethod(IsotopeLabelType.heavy))); PeptideGroupDocNode protein = srmDocument.MoleculeGroups.First(); PeptideDocNode peptide = protein.Peptides.First(); peptide = peptide.ChangeInternalStandardConcentration(internalStandardConcentration); PeptideQuantifier peptideQuantifier = PeptideQuantifier.GetPeptideQuantifier(srmDocument.Settings, protein, peptide); CalibrationCurveFitter curveFitter = new CalibrationCurveFitter(peptideQuantifier, srmDocument.Settings); Assert.AreEqual(CalibrationCurveFitter.ConcentrationRatioText(IsotopeLabelType.light, IsotopeLabelType.heavy), curveFitter.GetXAxisTitle()); Assert.AreEqual(CalibrationCurveFitter.PeakAreaRatioText(IsotopeLabelType.light, IsotopeLabelType.heavy), curveFitter.GetYAxisTitle()); var chromatograms = srmDocument.Settings.MeasuredResults.Chromatograms; for (int iReplicate = 0; iReplicate < chromatograms.Count; iReplicate++) { string msg = string.Format("Replicate {0}", iReplicate); var expectedY = peptide.Results[iReplicate].First().LabelRatios.First().Ratio.Ratio; double?actualY = curveFitter.GetYValue(iReplicate).Value; Assert.IsNotNull(actualY); Assert.AreEqual(expectedY, actualY.Value, epsilon, msg); var calibrationCurve = curveFitter.GetCalibrationCurve(); Assert.AreEqual(1, calibrationCurve.PointCount); var expectedConcentration = expectedY * internalStandardConcentration / calibrationCurve.Slope.Value; Assert.AreEqual(expectedConcentration / internalStandardConcentration, curveFitter.GetCalculatedXValue(calibrationCurve, iReplicate).GetValueOrDefault(double.NaN), epsilon, msg); Assert.AreEqual(expectedConcentration, curveFitter.GetCalculatedConcentration(calibrationCurve, iReplicate).GetValueOrDefault(double.NaN), epsilon, msg); var chromatogramSet = chromatograms[iReplicate]; if (Equals(chromatogramSet.SampleType, SampleType.STANDARD) && chromatogramSet.AnalyteConcentration.HasValue) { // Since there was only one standard, the regression line goes exactly through this sample. Assert.AreEqual(expectedConcentration, chromatogramSet.AnalyteConcentration.Value * peptide.ConcentrationMultiplier.GetValueOrDefault(1.0), epsilon); } } }
protected void UpdateSettings() { var groupComparisonDef = GroupComparisonModel.GroupComparisonDef; ReplaceComboItems(comboControlAnnotation, ListReplicateAnnotations(), groupComparisonDef.ControlAnnotation); string[] controlValues = ListControlValues(); ReplaceComboItems(comboControlValue, controlValues, groupComparisonDef.ControlValue ?? string.Empty); var caseValues = new HashSet <string>(controlValues) { string.Empty }; if (null != groupComparisonDef.ControlValue) { caseValues.Remove(groupComparisonDef.ControlValue); } var sortedCaseValues = caseValues.ToArray(); Array.Sort(sortedCaseValues); ReplaceComboItems(comboCaseValue, sortedCaseValues, groupComparisonDef.CaseValue ?? string.Empty); ReplaceComboItems(comboIdentityAnnotation, new[] { string.Empty }.Concat(ListReplicateAnnotations()), groupComparisonDef.IdentityAnnotation); ReplaceComboItems(comboNormalizationMethod, NormalizationMethod.ListNormalizationMethods(GroupComparisonModel.Document), groupComparisonDef.NormalizationMethod); ReplaceComboItems(comboSummaryMethod, SummarizationMethod.ListSummarizationMethods(), groupComparisonDef.SummarizationMethod); tbxConfidenceLevel.Text = groupComparisonDef.ConfidenceLevelTimes100.ToString(CultureInfo.CurrentCulture); radioScopeProtein.Checked = groupComparisonDef.PerProtein; radioScopePeptide.Checked = !groupComparisonDef.PerProtein; cbxUseZeroForMissingPeaks.Checked = groupComparisonDef.UseZeroForMissingPeaks; cbxUseZeroForMissingPeaks.Visible = GroupComparisonModel.Document.Settings.PeptideSettings.Integration.PeakScoringModel != null; if (GroupComparisonDef.QValueCutoff.HasValue) { tbxQValueCutoff.Text = groupComparisonDef.QValueCutoff.Value.ToString(CultureInfo.CurrentCulture); groupBoxQValueCutoff.Visible = true; } else { tbxQValueCutoff.Text = string.Empty; } if (RequiresAdvanced(groupComparisonDef)) { ShowAdvanced(true); } }
public static IEnumerable <QuantificationSettings> ListAllQuantificationSettings() { foreach (var normalizationMethod in new[] { NormalizationMethod.NONE, NormalizationMethod.GetNormalizationMethod(IsotopeLabelType.heavy), }) { foreach (var regressionFit in RegressionFit.All) { foreach (var weighting in RegressionWeighting.All) { foreach (var msLevel in new int?[] { 1, 2, null }) { yield return(new QuantificationSettings(weighting) .ChangeNormalizationMethod(normalizationMethod) .ChangeRegressionFit(regressionFit) .ChangeMsLevel(msLevel)); } } } } }
public double?GetTransitionGroupValue(NormalizationMethod normalizationMethod, PeptideDocNode peptideDocNode, TransitionGroupDocNode transitionGroupDocNode, TransitionGroupChromInfo transitionGroupChromInfo) { if (transitionGroupChromInfo == null) { return(null); } if (TryGetDenominator(normalizationMethod, transitionGroupDocNode.LabelType, transitionGroupChromInfo.FileId, out double?denominator)) { return(transitionGroupChromInfo.Area / denominator); } if (normalizationMethod is NormalizationMethod.RatioToLabel ratioToLabel) { return(GetTransitionGroupRatioValue(ratioToLabel, peptideDocNode, transitionGroupDocNode, transitionGroupChromInfo)?.Ratio); } return(null); }
public void TestInternalCalibration() { const double internalStandardConcentration = 80.0; var srmDocument = LoadTestDocument(); AssertEx.IsDocumentState(srmDocument, null, 1, 1, 2, 10); srmDocument = ChangeStandardConcentrationCount(srmDocument, 0); srmDocument = ChangeQuantificationSettings(srmDocument, QuantificationSettings.DEFAULT .ChangeRegressionFit(RegressionFit.NONE) .ChangeNormalizationMethod(NormalizationMethod.GetNormalizationMethod(IsotopeLabelType.heavy)) .ChangeUnits("ng/mL")); PeptideGroupDocNode protein = srmDocument.MoleculeGroups.First(); PeptideDocNode peptide = protein.Peptides.First(); peptide = peptide.ChangeInternalStandardConcentration(internalStandardConcentration); CalibrationCurveFitter curveFitter = CalibrationCurveFitter.GetCalibrationCurveFitter(srmDocument.Settings, protein, peptide); string expectedXAxis = CalibrationCurveFitter.AppendUnits(QuantificationStrings.Analyte_Concentration, "ng/mL"); Assert.AreEqual(expectedXAxis, curveFitter.GetXAxisTitle()); string expectedYAxis = CalibrationCurveFitter.PeakAreaRatioText(IsotopeLabelType.light, IsotopeLabelType.heavy); Assert.AreEqual(expectedYAxis, curveFitter.GetYAxisTitle()); var chromatograms = srmDocument.Settings.MeasuredResults.Chromatograms; for (int iReplicate = 0; iReplicate < chromatograms.Count; iReplicate++) { string msg = string.Format("Replicate {0}", iReplicate); var expectedY = peptide.Results[iReplicate].First().LabelRatios.First().Ratio.Ratio; Assert.AreEqual(expectedY, curveFitter.GetYValue(iReplicate).Value, epsilon, msg); var calibrationCurve = curveFitter.GetCalibrationCurve(); Assert.AreEqual(1 / internalStandardConcentration, calibrationCurve.Slope); Assert.IsNull(calibrationCurve.RSquared); Assert.AreEqual(expectedY * internalStandardConcentration, curveFitter.GetCalculatedXValue(calibrationCurve, iReplicate).GetValueOrDefault(double.NaN), epsilon, msg); Assert.AreEqual(expectedY * internalStandardConcentration, curveFitter.GetCalculatedConcentration(calibrationCurve, iReplicate).GetValueOrDefault(double.NaN), epsilon, msg); } }
public static ResNodeDenseDef[] ResNodeLayers(int numOfNodes, int hiddenSize, NormalizationMethod normalizatoin = NormalizationMethod.None, float dropout = 0.0f) { var result = new ResNodeDenseDef[numOfNodes]; for (int i = 0; i < numOfNodes; ++i) { result[i] = new ResNodeDenseDef(hiddenSize, normalizatoin, dropout); } return(result); }
public static LayerDenseDef[] DenseLayers(int numOfLayers, int hiddenSize, bool hasBias = true, NormalizationMethod normalizatoin = NormalizationMethod.None, float dropout = 0.0f, float initialWeightScale = 0.1f, LayerDef activation = null) { var result = new LayerDenseDef[numOfLayers]; for (int i = 0; i < numOfLayers; ++i) { result[i] = new LayerDenseDef(hiddenSize, normalizatoin, activation, dropout); result[i].HasBias = hasBias; result[i].InitialWeightScale = initialWeightScale; } return(result); }
public QuantificationSettings ChangeNormalizationMethod(NormalizationMethod normalizationMethod) { return(ChangeProp(ImClone(this), im => im.NormalizationMethod = normalizationMethod)); }
protected override void DoTest() { Settings.Default.CalibrationCurveOptions.DisplaySampleTypes = new[] { SampleType.UNKNOWN.Name, SampleType.QC.Name, SampleType.STANDARD.Name }; RunUI(() => SkylineWindow.ShowCalibrationForm()); var calibrationForm = FindOpenForm <CalibrationForm>(); Assert.AreEqual(QuantificationStrings.CalibrationForm_DisplayCalibrationCurve_No_results_available, calibrationForm.ZedGraphControl.GraphPane.Title.Text); PauseForScreenShot("Blank document"); RunUI(() => { SkylineWindow.OpenFile(TestFilesDir.GetTestPath("CalibrationTest.sky")); }); Assert.AreEqual(QuantificationStrings.CalibrationForm_DisplayCalibrationCurve_Select_a_peptide_to_see_its_calibration_curve, GetGraphTitle(calibrationForm)); PauseForScreenShot("No peptide selected"); RunUI(() => SkylineWindow.SequenceTree.SelectedPath = SkylineWindow.DocumentUI.GetPathTo( (int)SrmDocument.Level.Molecules, 0)); WaitForGraphs(); Assert.AreEqual(QuantificationStrings.CalibrationForm_DisplayCalibrationCurve_Use_the_Quantification_tab_on_the_Peptide_Settings_dialog_to_control_the_conversion_of_peak_areas_to_concentrations_, GetGraphTitle(calibrationForm)); PauseForScreenShot("Quantification not configured"); { var peptideSettingsUi = ShowDialog <PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI); RunUI(() => { peptideSettingsUi.SelectedTab = PeptideSettingsUI.TABS.Quantification; peptideSettingsUi.QuantNormalizationMethod = NormalizationMethod.GetNormalizationMethod(IsotopeLabelType.heavy); peptideSettingsUi.QuantUnits = "ng/mL"; }); PauseForScreenShot("Peptide Settings - Quantification tab"); OkDialog(peptideSettingsUi, peptideSettingsUi.OkDialog); } PauseForScreenShot("Normalization without Internal Standard Concentration"); WaitForOpenForm <CalibrationForm>(); RunUI(() => SkylineWindow.ShowDocumentGrid(true)); var documentGrid = FindOpenForm <DocumentGridForm>(); // Now, specify an internal standard concentration. RunUI(() => documentGrid.ChooseView("PeptidesWithCalibration")); WaitForConditionUI(() => documentGrid.IsComplete); RunUI(() => { var colInternalStandardQuantification = documentGrid.FindColumn(PropertyPath.Root.Property("InternalStandardConcentration")); documentGrid.DataGridView.Rows[0].Cells[colInternalStandardQuantification.Index].Value = 80.0; SkylineWindow.ShowCalibrationForm(); }); Assert.IsNull(GetGraphTitle(calibrationForm)); PauseForScreenShot("Internal calibration only"); RunUI(() => { var colInternalStandardQuantification = documentGrid.FindColumn(PropertyPath.Root.Property("InternalStandardConcentration")); documentGrid.DataGridView.Rows[0].Cells[colInternalStandardQuantification.Index].Value = null; }); FillInSampleTypesAndConcentrations(); WaitForGraphs(); { var peptideSettingsUi = ShowDialog <PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI); RunUI(() => { peptideSettingsUi.QuantNormalizationMethod = NormalizationMethod.NONE; peptideSettingsUi.QuantRegressionFit = RegressionFit.LINEAR; }); OkDialog(peptideSettingsUi, peptideSettingsUi.OkDialog); RunUI(() => SkylineWindow.ShowCalibrationForm()); } PauseForScreenShot("External Calibration Without Internal Standard"); { var peptideSettingsUi = ShowDialog <PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI); RunUI(() => peptideSettingsUi.QuantNormalizationMethod = NormalizationMethod.GetNormalizationMethod(IsotopeLabelType.heavy)); OkDialog(peptideSettingsUi, peptideSettingsUi.OkDialog); } PauseForScreenShot("External Calibration normalized to heavy"); RunUI(() => documentGrid.ChooseView("PeptidesWithCalibration")); WaitForConditionUI(() => documentGrid.IsComplete); RunUI(() => { var colInternalStandardQuantification = documentGrid.FindColumn(PropertyPath.Root.Property("InternalStandardConcentration")); documentGrid.DataGridView.Rows[0].Cells[colInternalStandardQuantification.Index].Value = 80.0; SkylineWindow.ShowCalibrationForm(); }); PauseForScreenShot("External calibration with internal standard concentration specified"); TestAllQuantificationSettings(); }
public static NormalizeOption FromNormalizationMethod(NormalizationMethod normalizationMethod) { return(new Simple(normalizationMethod)); }
public bool Is(NormalizationMethod normalizationMethod) { return(Equals(NormalizationMethod, normalizationMethod)); }