提交 | 用户 | 时间
|
7fd198
|
1 |
package com.iailab.module.model.mdk.sample; |
潘 |
2 |
|
50084d
|
3 |
import com.iailab.module.model.mdk.common.exceptions.ModelInvokeException; |
6c2ff1
|
4 |
import com.iailab.module.model.mdk.sample.dto.ColumnItemPort; |
7fd198
|
5 |
import com.iailab.module.model.mdk.sample.dto.SampleData; |
潘 |
6 |
import com.iailab.module.model.mdk.sample.dto.SampleInfo; |
efdc38
|
7 |
import lombok.extern.slf4j.Slf4j; |
7fd198
|
8 |
import org.springframework.beans.factory.annotation.Autowired; |
潘 |
9 |
import org.springframework.stereotype.Component; |
6c2ff1
|
10 |
import org.springframework.util.CollectionUtils; |
7fd198
|
11 |
|
潘 |
12 |
import java.text.MessageFormat; |
|
13 |
import java.util.Date; |
|
14 |
import java.util.List; |
6c2ff1
|
15 |
import java.util.Map; |
7fd198
|
16 |
|
潘 |
17 |
/** |
|
18 |
* 样本构造 |
|
19 |
* |
|
20 |
* @author PanZhibao |
|
21 |
* @Description |
|
22 |
* @createTime 2024年09月03日 |
|
23 |
*/ |
efdc38
|
24 |
@Slf4j |
7fd198
|
25 |
@Component |
潘 |
26 |
public class SampleConstructor { |
|
27 |
|
|
28 |
@Autowired |
|
29 |
private SampleFactory sampleFactory; |
|
30 |
|
bab433
|
31 |
public List<SampleData> constructSample(String typeA, String modelId, Date runTime,String itemName, |
潘 |
32 |
Map<Integer, Integer> dynamicDataLength) throws ModelInvokeException { |
7fd198
|
33 |
try { |
潘 |
34 |
SampleInfoConstructor sampleInfoConstructor = sampleFactory.createSampleInfo(typeA, modelId); |
bab433
|
35 |
SampleInfo sampleInfo = sampleInfoConstructor.prepareSampleInfo(modelId, runTime, dynamicDataLength); |
eca625
|
36 |
SampleDataConstructor sampleDataConstructor = sampleFactory.createSampleData(typeA); |
7fd198
|
37 |
return sampleDataConstructor.prepareSampleData(sampleInfo); |
潘 |
38 |
} catch (Exception e) { |
c9dd12
|
39 |
e.printStackTrace(); |
efdc38
|
40 |
log.error("获取模型的算法参数异常",e); |
50084d
|
41 |
throw new ModelInvokeException(MessageFormat.format("{0},Name:{1}", |
D |
42 |
ModelInvokeException.errorGetModelArithParam, itemName)); |
7fd198
|
43 |
} |
潘 |
44 |
|
|
45 |
|
|
46 |
} |
|
47 |
} |