추론관리 > 모델관리 목록 score 항목들 추가
This commit is contained in:
@@ -2,6 +2,7 @@ package com.kamco.cd.kamcoback.model.dto;
|
||||
|
||||
import com.kamco.cd.kamcoback.common.utils.interfaces.JsonFormatDttm;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.ZonedDateTime;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
@@ -69,7 +70,12 @@ public class ModelMgmtDto {
|
||||
private String dockerFileNm;
|
||||
private String modelType;
|
||||
private String createCompleteDttm;
|
||||
private String recentUseDttm;
|
||||
private String recentUseDttm; // TODO: 추론관리 테이블 나오면 분석진행중일 때 사용중으로 리턴하기
|
||||
private BigDecimal f1Score;
|
||||
private BigDecimal precision;
|
||||
private BigDecimal recall;
|
||||
private BigDecimal accuracy;
|
||||
private BigDecimal iou;
|
||||
private Boolean deleted;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.kamco.cd.kamcoback.postgres.entity;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Map;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.JdbcTypeCode;
|
||||
import org.hibernate.type.SqlTypes;
|
||||
|
||||
@Entity
|
||||
@Table(name = "tb_model_result_metric")
|
||||
@Getter
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ModelResultMetricEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "metric_uid")
|
||||
private Long id;
|
||||
|
||||
@Column(name = "model_uid")
|
||||
private Long modelUid;
|
||||
|
||||
@Column(name = "model_ver_uid")
|
||||
private Long modelVerUid;
|
||||
|
||||
@JdbcTypeCode(SqlTypes.JSON)
|
||||
@Column(name = "metrics", columnDefinition = "jsonb")
|
||||
private Map<String, Object> metrics;
|
||||
|
||||
@Column(name = "f1_score")
|
||||
private Double f1Score;
|
||||
|
||||
@Column(name = "precision")
|
||||
private Double precision;
|
||||
|
||||
@Column(name = "recall")
|
||||
private Double recall;
|
||||
|
||||
@Column(name = "loss")
|
||||
private Double loss;
|
||||
|
||||
@Column(name = "iou")
|
||||
private Double iou;
|
||||
|
||||
@Column(name = "created_dttm", updatable = false, nullable = false)
|
||||
private ZonedDateTime createdDate;
|
||||
|
||||
@PrePersist
|
||||
protected void onPersist() {
|
||||
this.createdDate = ZonedDateTime.now();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository.model;
|
||||
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QModelMgmtEntity.modelMgmtEntity;
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QModelResultMetricEntity.modelResultMetricEntity;
|
||||
|
||||
import com.kamco.cd.kamcoback.model.dto.ModelMgmtDto;
|
||||
import com.kamco.cd.kamcoback.postgres.QuerydslOrderUtil;
|
||||
@@ -10,8 +11,10 @@ import com.querydsl.core.types.Expression;
|
||||
import com.querydsl.core.types.Projections;
|
||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||
import com.querydsl.core.types.dsl.Expressions;
|
||||
import com.querydsl.core.types.dsl.NumberPath;
|
||||
import com.querydsl.core.types.dsl.StringExpression;
|
||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
@@ -79,8 +82,15 @@ public class ModelMgmtRepositoryImpl extends QuerydslRepositorySupport
|
||||
"to_char({0}, 'YYYY-MM-DD')", modelMgmtEntity.createCompleteDttm),
|
||||
Expressions.stringTemplate(
|
||||
"to_char({0}, 'YYYY-MM-DD')", modelMgmtEntity.recentUseDttm),
|
||||
roundNumericToPercent(modelResultMetricEntity.f1Score),
|
||||
roundNumericToPercent(modelResultMetricEntity.precision),
|
||||
roundNumericToPercent(modelResultMetricEntity.recall),
|
||||
roundNumericToPercent(modelResultMetricEntity.loss),
|
||||
roundNumericToPercent(modelResultMetricEntity.iou),
|
||||
modelMgmtEntity.deleted))
|
||||
.from(modelMgmtEntity)
|
||||
.innerJoin(modelResultMetricEntity)
|
||||
.on(modelMgmtEntity.modelUid.longValue().eq(modelResultMetricEntity.modelUid))
|
||||
.where(
|
||||
eventEndedAtBetween(startDate, endDate, property),
|
||||
searchModelVersion(modelType, searchVal))
|
||||
@@ -138,4 +148,8 @@ public class ModelMgmtRepositoryImpl extends QuerydslRepositorySupport
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
private Expression<BigDecimal> roundNumericToPercent(NumberPath<Double> ratio) {
|
||||
return Expressions.numberTemplate(BigDecimal.class, "function('round', {0} * 100, 2)", ratio);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user