feat/training_260202 #135
@@ -115,10 +115,7 @@ public class HyperParamDto {
|
|||||||
@JsonFormatDttm private ZonedDateTime createDttm;
|
@JsonFormatDttm private ZonedDateTime createDttm;
|
||||||
@JsonFormatDttm private ZonedDateTime lastUsedDttm;
|
@JsonFormatDttm private ZonedDateTime lastUsedDttm;
|
||||||
private String memo;
|
private String memo;
|
||||||
private Long m1UseCnt;
|
private Long totalUseCnt;
|
||||||
private Long m2UseCnt;
|
|
||||||
private Long m3UseCnt;
|
|
||||||
private Long totalCnt;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ public class HyperParamCoreService {
|
|||||||
*/
|
*/
|
||||||
public HyperParamDto.Basic getInitHyperParam(ModelType model) {
|
public HyperParamDto.Basic getInitHyperParam(ModelType model) {
|
||||||
ModelHyperParamEntity entity =
|
ModelHyperParamEntity entity =
|
||||||
hyperParamRepository.getHyperparamByType(model).stream()
|
hyperParamRepository.getHyperParamByType(model).stream()
|
||||||
.filter(e -> e.getIsDefault() == Boolean.TRUE)
|
.filter(e -> e.getIsDefault() == Boolean.TRUE)
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElseThrow(() -> new CustomApiException("NOT_FOUND_DATA", HttpStatus.NOT_FOUND));
|
.orElseThrow(() -> new CustomApiException("NOT_FOUND_DATA", HttpStatus.NOT_FOUND));
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ public class ModelTrainMngCoreService {
|
|||||||
if (HyperParamSelectType.OPTIMIZED.getId().equals(addReq.getHyperParamType())) {
|
if (HyperParamSelectType.OPTIMIZED.getId().equals(addReq.getHyperParamType())) {
|
||||||
ModelType modelType = ModelType.getValueData(addReq.getModelNo());
|
ModelType modelType = ModelType.getValueData(addReq.getModelNo());
|
||||||
hyperParamEntity =
|
hyperParamEntity =
|
||||||
hyperParamRepository.getHyperparamByType(modelType).stream()
|
hyperParamRepository.getHyperParamByType(modelType).stream()
|
||||||
.filter(e -> e.getIsDefault() == Boolean.TRUE)
|
.filter(e -> e.getIsDefault() == Boolean.TRUE)
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
|
|||||||
@@ -303,15 +303,6 @@ public class ModelHyperParamEntity {
|
|||||||
@Column(name = "last_used_dttm")
|
@Column(name = "last_used_dttm")
|
||||||
private ZonedDateTime lastUsedDttm;
|
private ZonedDateTime lastUsedDttm;
|
||||||
|
|
||||||
@Column(name = "m1_use_cnt")
|
|
||||||
private Long m1UseCnt = 0L;
|
|
||||||
|
|
||||||
@Column(name = "m2_use_cnt")
|
|
||||||
private Long m2UseCnt = 0L;
|
|
||||||
|
|
||||||
@Column(name = "m3_use_cnt")
|
|
||||||
private Long m3UseCnt = 0L;
|
|
||||||
|
|
||||||
@Column(name = "model_type")
|
@Column(name = "model_type")
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
private ModelType modelType;
|
private ModelType modelType;
|
||||||
|
|||||||
@@ -29,9 +29,28 @@ public interface HyperParamRepositoryCustom {
|
|||||||
|
|
||||||
Optional<ModelHyperParamEntity> findHyperParamByHyperVer(String hyperVer);
|
Optional<ModelHyperParamEntity> findHyperParamByHyperVer(String hyperVer);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 하이퍼 파라미터 상세조회
|
||||||
|
*
|
||||||
|
* @param uuid
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
Optional<ModelHyperParamEntity> findHyperParamByUuid(UUID uuid);
|
Optional<ModelHyperParamEntity> findHyperParamByUuid(UUID uuid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 하이퍼 파라미터 목록 조회
|
||||||
|
*
|
||||||
|
* @param model
|
||||||
|
* @param req
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
Page<HyperParamDto.List> findByHyperVerList(ModelType model, SearchReq req);
|
Page<HyperParamDto.List> findByHyperVerList(ModelType model, SearchReq req);
|
||||||
|
|
||||||
List<ModelHyperParamEntity> getHyperparamByType(ModelType modelType);
|
/**
|
||||||
|
* 하이퍼 파라미터 모델타입으로 조회
|
||||||
|
*
|
||||||
|
* @param modelType
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<ModelHyperParamEntity> getHyperParamByType(ModelType modelType);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import com.kamco.cd.training.hyperparam.dto.HyperParamDto.SearchReq;
|
|||||||
import com.kamco.cd.training.postgres.entity.ModelHyperParamEntity;
|
import com.kamco.cd.training.postgres.entity.ModelHyperParamEntity;
|
||||||
import com.querydsl.core.BooleanBuilder;
|
import com.querydsl.core.BooleanBuilder;
|
||||||
import com.querydsl.core.types.Projections;
|
import com.querydsl.core.types.Projections;
|
||||||
import com.querydsl.core.types.dsl.NumberExpression;
|
|
||||||
import com.querydsl.jpa.impl.JPAQuery;
|
import com.querydsl.jpa.impl.JPAQuery;
|
||||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
@@ -91,10 +90,12 @@ public class HyperParamRepositoryImpl implements HyperParamRepositoryCustom {
|
|||||||
Pageable pageable = req.toPageable();
|
Pageable pageable = req.toPageable();
|
||||||
|
|
||||||
BooleanBuilder builder = new BooleanBuilder();
|
BooleanBuilder builder = new BooleanBuilder();
|
||||||
|
|
||||||
|
builder.and(modelHyperParamEntity.delYn.isFalse());
|
||||||
|
|
||||||
if (model != null) {
|
if (model != null) {
|
||||||
builder.and(modelHyperParamEntity.modelType.eq(model));
|
builder.and(modelHyperParamEntity.modelType.eq(model));
|
||||||
}
|
}
|
||||||
builder.and(modelHyperParamEntity.delYn.isFalse());
|
|
||||||
|
|
||||||
if (req.getHyperVer() != null && !req.getHyperVer().isEmpty()) {
|
if (req.getHyperVer() != null && !req.getHyperVer().isEmpty()) {
|
||||||
// 버전
|
// 버전
|
||||||
@@ -118,13 +119,6 @@ public class HyperParamRepositoryImpl implements HyperParamRepositoryCustom {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NumberExpression<Long> totalUseCnt =
|
|
||||||
modelHyperParamEntity
|
|
||||||
.m1UseCnt
|
|
||||||
.coalesce(0L)
|
|
||||||
.add(modelHyperParamEntity.m2UseCnt.coalesce(0L))
|
|
||||||
.add(modelHyperParamEntity.m3UseCnt.coalesce(0L));
|
|
||||||
|
|
||||||
JPAQuery<HyperParamDto.List> query =
|
JPAQuery<HyperParamDto.List> query =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(
|
.select(
|
||||||
@@ -135,11 +129,7 @@ public class HyperParamRepositoryImpl implements HyperParamRepositoryCustom {
|
|||||||
modelHyperParamEntity.hyperVer,
|
modelHyperParamEntity.hyperVer,
|
||||||
modelHyperParamEntity.createdDttm,
|
modelHyperParamEntity.createdDttm,
|
||||||
modelHyperParamEntity.lastUsedDttm,
|
modelHyperParamEntity.lastUsedDttm,
|
||||||
modelHyperParamEntity.memo,
|
modelHyperParamEntity.memo))
|
||||||
modelHyperParamEntity.m1UseCnt,
|
|
||||||
modelHyperParamEntity.m2UseCnt,
|
|
||||||
modelHyperParamEntity.m3UseCnt,
|
|
||||||
totalUseCnt.as("totalUseCnt")))
|
|
||||||
.from(modelHyperParamEntity)
|
.from(modelHyperParamEntity)
|
||||||
.where(builder);
|
.where(builder);
|
||||||
|
|
||||||
@@ -165,8 +155,6 @@ public class HyperParamRepositoryImpl implements HyperParamRepositoryCustom {
|
|||||||
? modelHyperParamEntity.lastUsedDttm.asc()
|
? modelHyperParamEntity.lastUsedDttm.asc()
|
||||||
: modelHyperParamEntity.lastUsedDttm.desc());
|
: modelHyperParamEntity.lastUsedDttm.desc());
|
||||||
|
|
||||||
case "totalUseCnt" -> query.orderBy(asc ? totalUseCnt.asc() : totalUseCnt.desc());
|
|
||||||
|
|
||||||
default -> query.orderBy(modelHyperParamEntity.createdDttm.desc());
|
default -> query.orderBy(modelHyperParamEntity.createdDttm.desc());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -187,7 +175,7 @@ public class HyperParamRepositoryImpl implements HyperParamRepositoryCustom {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ModelHyperParamEntity> getHyperparamByType(ModelType modelType) {
|
public List<ModelHyperParamEntity> getHyperParamByType(ModelType modelType) {
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.select(modelHyperParamEntity)
|
.select(modelHyperParamEntity)
|
||||||
.from(modelHyperParamEntity)
|
.from(modelHyperParamEntity)
|
||||||
|
|||||||
Reference in New Issue
Block a user