Skip to content

Commit

Permalink
Merge pull request #153 from FederatedAI/develop-1.10.0
Browse files Browse the repository at this point in the history
Develop 1.10.0
  • Loading branch information
idwenwen authored Dec 29, 2022
2 parents 47ca4a3 + 6269584 commit 94da5f5
Show file tree
Hide file tree
Showing 19 changed files with 360 additions and 175 deletions.
10 changes: 2 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,8 @@ jobs:
- name: check out the repo
uses: actions/checkout@v2

- name: compile node.js code
working-directory: resources-front-end
run: |
npm install
npm run build
- name: compile java code
run: mvn clean package
- name: mvn compile
run: mvn -DskipTests clean package

- name: archive artifacts
uses: actions/upload-artifact@v2
Expand Down
13 changes: 13 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# Release 1.10.0

#### Major Features and Improvements
**Major Features**

* Display SBT leaf node data
* Support result summary display for Sampler's new method
* Add model summary for new module Positive Unlabeled Learning
* Improved table display for Binning
* Data filtering on requested model proto
* Adjusted Design
* Improved Logging display adaptation

# Release 1.9.1

#### Major Features and Improvements
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>fateboard</groupId>
<artifactId>fateboard</artifactId>
<version>1.9.1</version>
<version>1.10.0</version>

<parent>
<groupId>org.springframework.boot</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ class CompExpression {
}
this.output.push(CACHEOUTPUT)
}
if (!this.belone.toLowerCase().match(/(intersection|evaluation|upload|download|rsa|datasplit|^reader|union|scorecard|cacheloader|writer|sample$)/i)) {
if (!this.belone.toLowerCase().match(/(intersection|evaluation|upload|download|rsa|datasplit|^reader|union|scorecard|cacheloader|writer|sample|positiveunlabeled$)/i)) {
if (!this.belone.toLowerCase().match(/(statistics|pearson|psi|modelloader)/i)) {
this.input.push(MODELINPUT)
}
Expand Down
3 changes: 2 additions & 1 deletion resources-front-end/src/store/modules/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ const app = {
CacheLoader: 'CacheLoader',
SSHELinR: 'SSHELinR',
SSHEPoissonR: 'SSHEPoissonR',
Writer: 'Writer'
Writer: 'Writer',
PositiveUnlabeled: 'PositiveUnlabeled'
},
metricTypeMap: {
dataIOTable: 'DATAIO_TABLE',
Expand Down
25 changes: 19 additions & 6 deletions resources-front-end/src/transform/fn/HeteroFeatureBinning.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ function runningTransform(responseData, role, pre) {
binningResult,
hostPartyIds
} = multiClassResult || (responseData.data && responseData.data.data)
const {
optimalMetricMethod
} = responseData.data && responseData.data.meta && responseData.data.meta.meta_data
return multiClassTransform(
header,
headerAnonymous,
Expand All @@ -125,7 +128,8 @@ function runningTransform(responseData, role, pre) {
hostPartyIds,
skipStatic,
role,
pre
pre,
optimalMetricMethod
)
}

Expand All @@ -145,6 +149,9 @@ function predictTransform(responseData, role, pre) {
hostResults,
binningResult
} = transformMultiClassResult || {}
const {
optimalMetricMethod
} = responseData.data && responseData.data.meta && responseData.data.meta.meta_data
if (!hostResults) hostResults = responseData.data ? responseData.data.data.transformHostResults : null
if (!binningResult) binningResult = responseData.data ? responseData.data.data.transformBinningResult : null
if (hostResults && binningResult) {
Expand All @@ -158,7 +165,8 @@ function predictTransform(responseData, role, pre) {
hostPartyIds,
skipStatic,
role,
pre
pre,
optimalMetricMethod
)
}
}
Expand All @@ -173,7 +181,8 @@ function multiClassTransform(
hostPartyIds,
skipStatic,
crole,
preOfFile
preOfFile,
optimalMetric
) {
const result = []
const selections = []
Expand All @@ -182,7 +191,7 @@ function multiClassTransform(
for (let i = 0, l = labels.length; i < l; i++) {
if (hostResults[i] || results[i]) {
const hostList = subHost(hostResults, hostPartyIds, hostIndex)
result.push(binningHandler(results[i], hostList, header, headerAnonymous, skipStatic, crole, preOfFile))
result.push(binningHandler(results[i], hostList, header, headerAnonymous, skipStatic, optimalMetric, crole, preOfFile))
selections.push({
value: labels[i],
label: labels[i]
Expand All @@ -191,7 +200,7 @@ function multiClassTransform(
}
}
} else {
result.push(binningHandler((results && results[0]) || binningResult, hostResults, header, headerAnonymous, skipStatic, crole, preOfFile))
result.push(binningHandler((results && results[0]) || binningResult, hostResults, header, headerAnonymous, skipStatic, optimalMetric, crole, preOfFile))
}

const options = []
Expand Down Expand Up @@ -255,7 +264,7 @@ function multiClassTransform(
}
}

function binningHandler(binningResult, hostData, header, headerAnonymous, skipStatic, crole, preOfFile) {
function binningHandler(binningResult, hostData, header, headerAnonymous, skipStatic, optimalMetric, crole, preOfFile) {
let data = binningResult
let guestPartyId = 0
let role = ''
Expand Down Expand Up @@ -414,6 +423,10 @@ function binningHandler(binningResult, hostData, header, headerAnonymous, skipSt
createHeader('non_event_ratio')
]

if (optimalMetric) {
header2.splice(3, 0, createHeader('optimal_metric', optimalMetric))
}

if (crole === 'host') {
header1.splice(2, 0, createHeader('anonymInGuest', 'anonym'))
header2.splice(2, 0, createHeader('anonym in guest', 'anonym'))
Expand Down
2 changes: 1 addition & 1 deletion resources-front-end/src/transform/fn/HeteroLR.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const createAsyncOption = (name, props, method, transform, exportName, detail) =
})

async function HeteroLRHandler(modelData, metricsData, partyId, role, componentName, jobId) {
const responseData = modelData.data.data
const responseData = modelData.data ? modelData.data.data : undefined
const group = []
let modelComponent

Expand Down
2 changes: 1 addition & 1 deletion resources-front-end/src/transform/fn/HeteroNN.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const createAsyncOption = (name, props, method, transform, exportName, detail) =
})

async function HeteroNNHandler(modelData, metricsData, partyId, role, componentName, jobId) {
const responseData = modelData.data.data
const responseData = modelData.data ? modelData.data.data : undefined
const group = []
const modelComponent = []

Expand Down
50 changes: 50 additions & 0 deletions resources-front-end/src/transform/fn/PositiveUnlabeled.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/**
*
* Copyright 2019 The FATE Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

import metricsArrange from './metricsArrange'
import { getTransformMetricFn } from '../index'
import { each } from './uitls'

const fn = async(modelData, metricsData, partyId, role, componentName, jobId, modelType) => {
const params = {
party_id: partyId,
role: role,
component_name: componentName,
job_id: jobId,
model_type: modelType,
isEvaluation: 'Summary'
}
const group = []
let othersHandler
if (metricsData && !metricsData.msg.match('no data')) {
metricsData = metricsArrange(metricsData.data)
each(metricsData, md => {
if (md.name === 'others') {
othersHandler = getTransformMetricFn(md.name)
othersHandler = othersHandler.bind(null, md, params)
}
})
}
if (othersHandler) {
const others = await othersHandler()
group.push(...others)
}
return group
}

export default fn
3 changes: 2 additions & 1 deletion resources-front-end/src/transform/fn/Secureboost.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ function modelTreeData(modelData, partyId, role) {
trees.forEach((item, index) => {
const treeData = {
tree: item.tree,
leafCount: item.leafCount,
role,
partyId,
featureNameFidMapping,
Expand Down Expand Up @@ -297,7 +298,7 @@ function setGraphOptions(modelData, partyId, role) {
}

function transfromTreeData(props) {
const opts = handleTreeData(props.tree, props.role, props.partyId, props.featureNameFidMapping, props.splitMaskdict, props.missingDirMaskdict, props.type, props.workMode, props.treePartyId)
const opts = handleTreeData(props.tree, props.role, props.partyId, props.featureNameFidMapping, props.splitMaskdict, props.missingDirMaskdict, props.type, props.workMode, props.treePartyId, props.leafCount)
return [createComponent('chart', '', {
setting: setTreeDatasDiagram(opts.data, props.color),
width: opts.treeWidth,
Expand Down
9 changes: 5 additions & 4 deletions resources-front-end/src/transform/fn/binningDataHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ import { getStackBarOptions } from '@/utils/chart-options/stackBar'
import { isEmpty } from './uitls'
import multiply from 'lodash/multiply'

function formatFloatWithDefault(value, role, flag) {
function formatFloatWithDefault(value, role, flag, needDisplay = false) {
if (flag) {
return '-'
} else {
if (role === 'host') {
if (role === 'host' && !needDisplay) {
return '-'
} else if (value === undefined || value === null) {
return '-'
Expand Down Expand Up @@ -85,8 +85,9 @@ export default function(data, header, type, partyId, role, Currentrole, skipStat
event_ratio: event_ratio ? event_ratio.toFixed(4) + '%' : '',
non_event_count: formatFloatWithDefault(data[key].nonEventCountArray[index], Currentrole, skipStatic),
non_event_ratio: non_event_ratio ? non_event_ratio.toFixed(4) + '%' : '',
woe: formatFloatWithDefault(data[key].woeArray[index], Currentrole, skipStatic),
iv: formatFloatWithDefault(data[key].ivArray[index], Currentrole, skipStatic)
woe: formatFloatWithDefault(data[key].woeArray[index], Currentrole, skipStatic, true),
iv: formatFloatWithDefault(data[key].ivArray[index], Currentrole, skipStatic),
optimal_metric: data[key].optimalMetricArray ? formatFloatWithDefault(data[key].optimalMetricArray[index], Currentrole, skipStatic) : ''
})
formatterArr.push({
formatterBinning,
Expand Down
1 change: 1 addition & 0 deletions resources-front-end/src/transform/fn/const.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const MODEL_TYPES = {
}

export const METRIC_TYPES = {
POSITIVEUNLABELED: 'PU_MODEL',
DATAIO_TABLE: 'DATAIO_TABLE',
SCALE: 'SCALE',
LOSS: 'LOSS',
Expand Down
10 changes: 7 additions & 3 deletions resources-front-end/src/transform/metricFn/evaluationSummary.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default function(summary, quantilePR, isEvaluation) {
const tableData = flattenToTable(summary, (subitem, metric_name, item, metric_namespace, index) => {
if (index === 0) {
each(subitem.data, ([name]) => {
header.push(createHeader(name, name, { sortable: !isEvaluation }))
header.push(createHeader(name, name, { sortable: !(isEvaluation) }))
})
}
// console.log(subitem, metric_name, item, metric_namespace)
Expand All @@ -49,7 +49,9 @@ export default function(summary, quantilePR, isEvaluation) {
{
type: 'title',
props: {
title: isEvaluation ? 'Evaluation Scores' : 'Performance Scores'
title: !(typeof isEvaluation === 'string')
? (isEvaluation ? 'Evaluation Scores' : 'Performance Scores')
: isEvaluation
}
}
// {
Expand All @@ -68,7 +70,9 @@ export default function(summary, quantilePR, isEvaluation) {
data: tableData,
pageSize: 20,
zeroFormat: '0',
export: isEvaluation ? 'evaluation_scores' : 'performance_scores'
export: !(typeof isEvaluation === 'string')
? (isEvaluation ? 'evaluation_scores' : 'performance_scores')
: isEvaluation
}
}

Expand Down
Loading

0 comments on commit 94da5f5

Please sign in to comment.