public override Parameters GetParameters(IGroupDataProvider data) { return(new Parameters(new Parameter[] { new DoubleParam("C", 100) { Help = SvmClassification.cHelp } })); }
public ClassificationModel Train(BaseVector[] x, int[][] y, int ngroups, IGroupDataProvider data, int nthreads, Action<double> reportProgress) { return groupWiseSelection ? TrainGroupWise(x, y, ngroups, data, nthreads) : TrainGlobal(x, y, ngroups, data, nthreads, reportProgress); }
public ClassificationModel Train(BaseVector[] x, int[][] y, int ngroups, IGroupDataProvider data, int nthreads, Action <double> reportProgress) { return(groupWiseSelection ? TrainGroupWise(x, y, ngroups, data, nthreads) : TrainGlobal(x, y, ngroups, data, nthreads, reportProgress)); }
public PermissionsService(IRolesDataProvider roleDataProvider, IPermissionsDataProvider permissionsDataProvider, ILogger <PermissionsService> logger, IGroupDataProvider groupDataProvider) { _permissionsDataProvider = permissionsDataProvider ?? throw new ArgumentNullException(nameof(permissionsDataProvider)); _roleDataProvider = roleDataProvider ?? throw new ArgumentNullException(nameof(roleDataProvider)); _logger = logger; _groupDataProvider = groupDataProvider ?? throw new ArgumentNullException(nameof(groupDataProvider)); }
public override Parameters GetParameters(IGroupDataProvider data) { return(new Parameters(new Parameter[] { new DoubleParam("s0", 0) { Help = s0Help } })); }
public static Parameters[] GetAllSubParameters(IGroupDataProvider data) { Parameters[] result = new Parameters[allMethods.Length]; for (int i = 0; i < result.Length; i++){ result[i] = allMethods[i].GetParameters(data); } return result; }
public static Parameters[] GetAllSubParameters(IGroupDataProvider data) { Parameters[] result = new Parameters[allMethods.Length]; for (int i = 0; i < result.Length; i++) { result[i] = allMethods[i].GetParameters(data); } return(result); }
public override Parameters GetParameters(IGroupDataProvider data) { return new Parameters(new Parameter[]{ new DoubleParam("C", 100){Help = SvmClassification.cHelp}, new DoubleParam("Reduction factor", 1.414){ Help = "The feature set will be recursively reduced in size by this factor." } }); }
public ClassificationModel TrainGroupWise(int i, int[][] y, BaseVector[] x, IGroupDataProvider data) { int[][] yb = ToBinaryClasses(y, i); if (ranker == null || groupWiseNfeatures[i] >= x[0].Length) { return(classifier.Train(x, yb, 2, classifierParam, 1)); } int[] o = ranker.Rank(x, yb, 2, rankerParam, data, 1); int[] inds = nfeatures < o.Length ? ArrayUtils.SubArray(o, groupWiseNfeatures[i]) : o; return(new ClassificationOnSubFeatures(classifier.Train(ExtractFeatures(x, inds), yb, 2, classifierParam, 1), inds)); }
public RegressionModel Train(BaseVector[] x, float[] y, IGroupDataProvider data) { if (ranker == null || nfeatures >= x[0].Length){ return regressionMethod.Train(x, y, regressionParam, 1); } int[] o = ranker.Rank(x, y, rankerParam, data, 1); int[] inds = nfeatures < o.Length ? ArrayUtils.SubArray(o, nfeatures) : o; return new RegressionOnSubFeatures( regressionMethod.Train(ClassificationWithRanking.ExtractFeatures(x, inds), y, regressionParam, 1), inds); }
public override Parameters GetParameters(IGroupDataProvider data) { return(new Parameters(new DoubleParam("C", 100) { Help = SvmClassification.cHelp }, new DoubleParam("Reduction factor", 1.414) { Help = "The feature set will be recursively reduced in size by this factor." })); }
public RegressionModel Train(BaseVector[] x, float[] y, IGroupDataProvider data) { if (ranker == null || nfeatures >= x[0].Length) { return(regressionMethod.Train(x, y, regressionParam, 1)); } int[] o = ranker.Rank(x, y, rankerParam, data, 1); int[] inds = nfeatures < o.Length ? ArrayUtils.SubArray(o, nfeatures) : o; return (new RegressionOnSubFeatures( regressionMethod.Train(ClassificationWithRanking.ExtractFeatures(x, inds), y, regressionParam, 1), inds)); }
public ClassificationModel TrainGlobal(BaseVector[] x, int[][] y, int ngroups, IGroupDataProvider data, int nthreads, Action<double> reportProgress) { if (ranker == null || nfeatures >= x[0].Length){ return classifier.Train(x, y, ngroups, classifierParam, nthreads, reportProgress); } int[] o = ranker.Rank(x, y, ngroups, rankerParam, data, nthreads); int[] inds = nfeatures < o.Length ? ArrayUtils.SubArray(o, nfeatures) : o; return new ClassificationOnSubFeatures(classifier.Train(ExtractFeatures(x, inds), y, ngroups, classifierParam, nthreads), inds); }
public int[] Rank(BaseVector[] x, float[] y, Parameters param, IGroupDataProvider data, int nthreads) { int nfeatures = x[0].Length; double[] s = new double[nfeatures]; for (int i = 0; i < nfeatures; i++){ float[] xx = new float[x.Length]; for (int j = 0; j < xx.Length; j++){ xx[j] = (float)x[j][i]; } s[i] = CalcScore(xx, y); } return ArrayUtils.Order(s); }
public GroupMemberNotificationService(ILogger <GroupMemberNotificationService> logger, IEmailService emailService, IOptionsSnapshot <GovNotifyConfiguration> notifyConfig, IOptionsSnapshot <ApplicationGateway> gatewayConfig, IUserDataProvider userDataProvider, IGroupDataProvider groupDataProvider) { _logger = logger; _emailService = emailService; _govNotifyConfiguration = notifyConfig.Value; _userDataProvider = userDataProvider; _groupDataProvider = groupDataProvider ?? throw new ArgumentNullException(nameof(groupDataProvider)); _fqdn = gatewayConfig.Value.FQDN ?? throw new ArgumentNullException(nameof(gatewayConfig.Value.FQDN)); }
public override int[] Rank(BaseVector[] x, double[] y, Parameters param, IGroupDataProvider data, int nthreads) { int nfeatures = x[0].Length; double[] s = new double[nfeatures]; for (int i = 0; i < nfeatures; i++) { double[] xx = new double[x.Length]; for (int j = 0; j < xx.Length; j++) { xx[j] = x[j][i]; } s[i] = CalcScore(xx, y); } return(ArrayUtils.Order(s)); }
public override int[] Rank(BaseVector[] x, int[][] y, int ngroups, Parameters param, IGroupDataProvider data, int nthreads, Action<double> reportProgress) { SvmParameter sp = new SvmParameter{ kernelFunction = new LinearKernelFunction(), svmType = SvmType.CSvc, c = param.GetParam<double>("C").Value }; bool[] invert; SvmProblem[] problems = CreateProblems(x, y, ngroups, out invert); int[][] rankedSets = new int[problems.Length][]; for (int i = 0; i < problems.Length; ++i){ rankedSets[i] = RankBinary(problems[i], sp); } return CombineRankedFeaturesLists(rankedSets); }
public override int[] Rank(BaseVector[] x, int[][] y, int ngroups, Parameters param, IGroupDataProvider data, int nthreads, Action<double> reportProgress) { double s0 = param.GetParam<double>("s0").Value; int nfeatures = x[0].Length; int[][] yy = RearrangeGroups(y, ngroups); double[] s = new double[nfeatures]; for (int i = 0; i < nfeatures; i++){ double[] xx = new double[x.Length]; for (int j = 0; j < xx.Length; j++){ xx[j] = x[j][i]; } s[i] = CalcPvalue(xx, yy, ngroups, s0); } return ArrayUtils.Order(s); }
public RegressionModel[] Train(BaseVector[] x, float[] y, IGroupDataProvider data) { int[] o = ranker.Rank(x, y, rankerParam, data, 1); int[] sizes = GetSizes(x[0].Length, reductionFactor, maxFeatures); RegressionModel[] result = new RegressionModel[sizes.Length]; for (int i = 0; i < result.Length; i++){ if (i == 0 && sizes[0] == x[0].Length){ result[0] = classifier.Train(x, y, classifierParam, 1); } else{ int[] inds = ArrayUtils.SubArray(o, sizes[i]); result[i] = new RegressionOnSubFeatures( classifier.Train(ClassificationWithRanking.ExtractFeatures(x, inds), y, classifierParam, 1), inds); } } return result; }
public int[] Rank(BaseVector[] x, float[] y, Parameters param, IGroupDataProvider data, int nthreads) { int nfeatures = x[0].Length; float[] yr = ArrayUtils.RankF(y); double[] s = new double[nfeatures]; for (int i = 0; i < nfeatures; i++) { float[] xx = new float[x.Length]; for (int j = 0; j < xx.Length; j++) { xx[j] = (float)x[j][i]; } float[] xxr = ArrayUtils.RankF(xx); s[i] = CalcScore(xxr, yr); } return(ArrayUtils.Order(s)); }
public RegressionModel[] Train(BaseVector[] x, float[] y, IGroupDataProvider data) { int[] o = ranker.Rank(x, y, rankerParam, data, 1); int[] sizes = GetSizes(x[0].Length, reductionFactor, maxFeatures); RegressionModel[] result = new RegressionModel[sizes.Length]; for (int i = 0; i < result.Length; i++) { if (i == 0 && sizes[0] == x[0].Length) { result[0] = classifier.Train(x, y, classifierParam, 1); } else { int[] inds = ArrayUtils.SubArray(o, sizes[i]); result[i] = new RegressionOnSubFeatures( classifier.Train(ClassificationWithRanking.ExtractFeatures(x, inds), y, classifierParam, 1), inds); } } return(result); }
private const long MaxFileSizeBytes = 5242880; // 5MB public GroupService(ISystemClock systemClock, ILogger <DiscussionService> logger, IPermissionsService permissionsService, IFileCommand fileCommand, IImageBlobStorageProvider blobStorageProvider, IFileTypeValidator fileTypeValidator, IGroupImageService imageService, IGroupCommand groupCommand, IHtmlSanitizer htmlSanitizer, IGroupDataProvider groupDataProvider, IContentService contentService) { _systemClock = systemClock ?? throw new ArgumentNullException(nameof(systemClock)); _blobStorageProvider = blobStorageProvider ?? throw new ArgumentNullException(nameof(blobStorageProvider)); _permissionsService = permissionsService ?? throw new ArgumentNullException(nameof(permissionsService)); _fileTypeValidator = fileTypeValidator ?? throw new ArgumentNullException(nameof(fileTypeValidator)); _groupCommand = groupCommand ?? throw new ArgumentNullException(nameof(groupCommand)); _groupDataProvider = groupDataProvider ?? throw new ArgumentNullException(nameof(groupDataProvider)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _imageService = imageService ?? throw new ArgumentNullException(nameof(imageService)); _htmlSanitizer = htmlSanitizer ?? throw new ArgumentNullException(nameof(htmlSanitizer)); _contentService = contentService ?? throw new ArgumentNullException(nameof(contentService)); }
public ClassificationModel Train(BaseVector[] x, int[][] y, int ngroups, IGroupDataProvider data, int nthreads) { return Train(x, y, ngroups, data, nthreads, null); }
public override Parameters GetParameters(IGroupDataProvider data) { return(new Parameters()); }
public ClassificationModel TrainGroupWise(BaseVector[] x, int[][] y, int ngroups, IGroupDataProvider data, int nthreads) { ClassificationModel[] c = new ClassificationModel[ngroups]; ThreadDistributor td = new ThreadDistributor(nthreads, ngroups, i => { c[i] = TrainGroupWise(i, y, x, data); }); td.Start(); return new GroupWiseClassifier(c); }
public ClassificationModel TrainGroupWise(int i, int[][] y, BaseVector[] x, IGroupDataProvider data) { int[][] yb = ToBinaryClasses(y, i); if (ranker == null || groupWiseNfeatures[i] >= x[0].Length){ return classifier.Train(x, yb, 2, classifierParam, 1); } int[] o = ranker.Rank(x, yb, 2, rankerParam, data, 1); int[] inds = nfeatures < o.Length ? ArrayUtils.SubArray(o, groupWiseNfeatures[i]) : o; return new ClassificationOnSubFeatures(classifier.Train(ExtractFeatures(x, inds), yb, 2, classifierParam, 1), inds); }
public override Parameters GetParameters(IGroupDataProvider data) { return new Parameters(new Parameter[]{new DoubleParam("s0", 0){Help = s0Help}}); }
public UserService(IUserDataProvider userDataProvider, IGroupDataProvider groupDataProvider) { _userDataProvider = userDataProvider; _groupDataProvider = groupDataProvider; }
public int[] Rank(BaseVector[] x, int[][] y, int ngroups, Parameters param, IGroupDataProvider data, int nthreads) { return(Rank(x, y, ngroups, param, data, nthreads, null)); }
public override Parameters GetParameters(IGroupDataProvider data) { return new Parameters(new Parameter[]{new DoubleParam("C", 100){Help = SvmClassification.cHelp}}); }
public ClassificationModel TrainGroupWise(BaseVector[] x, int[][] y, int ngroups, IGroupDataProvider data, int nthreads) { ClassificationModel[] c = new ClassificationModel[ngroups]; ThreadDistributor td = new ThreadDistributor(nthreads, ngroups, i => { c[i] = TrainGroupWise(i, y, x, data); }); td.Start(); return(new GroupWiseClassifier(c)); }
public ClassificationModel Train(BaseVector[] x, int[][] y, int ngroups, IGroupDataProvider data, int nthreads) { return(Train(x, y, ngroups, data, nthreads, null)); }
public void Initialize(IConfigSource config) { IConfig groupsConfig = config.Configs["Groups"]; if (groupsConfig == null) { // Do not run this module by default. return; } else { m_groupsEnabled = groupsConfig.GetBoolean("Enabled", false); if (!m_groupsEnabled) { return; } if (groupsConfig.GetString("Module", "Default") != "FlexiGroups") { m_groupsEnabled = false; return; } m_log.Info("[GROUPS]: Initializing FlexiGroups"); m_groupData = ProviderFactory.GetProviderFromConfigName(m_log, groupsConfig, groupsConfig.GetString("Provider")); m_groupNoticesEnabled = groupsConfig.GetBoolean("XmlRpcNoticesEnabled", true); m_debugEnabled = groupsConfig.GetBoolean("XmlRpcDebugEnabled", true); } }
public override int[] Rank(BaseVector[] x, int[][] y, int ngroups, Parameters param, IGroupDataProvider data, int nthreads, Action <double> reportProgress) { int nfeatures = x[0].Length; int[][] yy = RearrangeGroups(y, ngroups); double[][] score = new double[ngroups][]; for (int k = 0; k < ngroups; k++) { score[k] = new double[nfeatures]; } for (int i = 0; i < nfeatures; i++) { double[] xx = new double[x.Length]; for (int j = 0; j < xx.Length; j++) { xx[j] = x[j][i]; } double[] singleFeatureScores = CalcGolubScore(xx, yy, ngroups); for (int c = 0; c < ngroups; ++c) { score[c][i] = singleFeatureScores[c]; } } return(CombineRankedFeaturesLists(nfeatures, score)); }
public abstract Parameters GetParameters(IGroupDataProvider data);
public abstract int[] Rank(BaseVector[] x, int[][] y, int ngroups, Parameters param, IGroupDataProvider data, int nthreads, Action <double> reportProgress);
public ClassificationModel TrainGlobal(BaseVector[] x, int[][] y, int ngroups, IGroupDataProvider data, int nthreads, Action <double> reportProgress) { if (ranker == null || nfeatures >= x[0].Length) { return(classifier.Train(x, y, ngroups, classifierParam, nthreads, reportProgress)); } int[] o = ranker.Rank(x, y, ngroups, rankerParam, data, nthreads); int[] inds = nfeatures < o.Length ? ArrayUtils.SubArray(o, nfeatures) : o; return (new ClassificationOnSubFeatures(classifier.Train(ExtractFeatures(x, inds), y, ngroups, classifierParam, nthreads), inds)); }
/// <summary> /// 构造函数 /// </summary> public GroupFacade() { groupData = ClassFactory.GetIGroupDataProvider(); }
public GroupService(IGroupDataProvider groupDataProvider) { _groupDataProvider = groupDataProvider; }
public Parameters GetParameters(IGroupDataProvider data) { return new Parameters(); }
public override int[] Rank(BaseVector[] x, int[][] y, int ngroups, Parameters param, IGroupDataProvider data, int nthreads, Action <double> reportProgress) { double s0 = param.GetParam <double>("s0").Value; int nfeatures = x[0].Length; int[][] yy = RearrangeGroups(y, ngroups); double[] s = new double[nfeatures]; for (int i = 0; i < nfeatures; i++) { double[] xx = new double[x.Length]; for (int j = 0; j < xx.Length; j++) { xx[j] = x[j][i]; } s[i] = CalcPvalue(xx, yy, ngroups, s0); } return(ArrayUtils.Order(s)); }
public override int[] Rank(BaseVector[] x, int[][] y, int ngroups, Parameters param, IGroupDataProvider data, int nthreads, Action <double> reportProgress) { SvmParameter sp = new SvmParameter { kernelFunction = new LinearKernelFunction(), svmType = SvmType.CSvc, c = param.GetParam <double>("C").Value }; bool[] invert; SvmProblem[] problems = CreateProblems(x, y, ngroups, out invert); int[][] rankedSets = new int[problems.Length][]; for (int i = 0; i < problems.Length; ++i) { rankedSets[i] = RankBinary(problems[i], sp); } return(CombineRankedFeaturesLists(rankedSets)); }
public abstract int[] Rank(BaseVector[] x, double[] y, Parameters param, IGroupDataProvider data, int nthreads);