분류 전체보기
-
random forest-1카테고리 없음 2023. 9. 14. 17:42
Returns 값에 다음 코드를 추가해 폐기임박 식품을 산출, n값을 조정: datetime.datetime: The time 'n' hours before the predicted disposal time. """ # 폐기임박 시점 계산 warning_time = disposal_date - datetime.timedelta(hours=3) return warning_time disposal_date, warning_time = get_disposal_time(production_date, microbial_index, physical_chemical_index, self_aging_index) print(f"The warning time is: {warning_time.strftime('%Y-%m-%..
-
blentea1카테고리 없음 2023. 9. 8. 16:45
from sklearn.metrics.pairwise import cosine_similarity t1 = np.array([[1, 1, 1]]) t2 = np.array([[2, 0, 1]]) cosine_similarity(t1,t2) SVD = TruncatedSVD(n_components=n) matrix = SVD.fit_transform(tea_user_recipe) matrix.shape import numpy as np t1 = np.array([1, 1, 1]) t2 = np.array([2, 0, 1]) from numpy import dot from numpy.linalg import norm def cos_sim(A, B): return dot(A, B)/(norm(A)*norm(..
-
7.28카테고리 없음 2023. 7. 24. 11:45
public class PaymentController { private PaymentService paymentService; public ResponseEntity processPayment(@RequestBody PaymentRequest paymentRequest) { CompletableFuture paymentResultFuture = CompletableFuture.supplyAsync(() -> { return paymentService.processPayment(paymentRequest); }); return ResponseEntity.accepted().build(); } } public class MainActivity extends AppCompatActivity { protect..
-
7.14카테고리 없음 2023. 7. 21. 16:58
image_list_title = [] image_list = [] image = imutils.resize(image, width=width) ratio = org_image.shape[1] / float(image.shape[1]) # contours를 찾아 크기순으로 정렬 cnts = cv2.findContours(edged.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) cnts = imutils.grab_contours(cnts) cnts = sorted(cnts, key=cv2.contourArea, reverse=True) receiptCnt = None # 정렬된 contours를 반복문으로 수행하며 4개의 꼭지점을 갖는 도형을 검출 for c ..
-
6.30카테고리 없음 2023. 7. 21. 12:54
public class BusinessDayService { private final BusinessDayRepository businessDayRepository; public BusinessDayService(BusinessDayRepository businessDayRepository) { this.businessDayRepository = businessDayRepository; } public BusinessDay addBusinessDay(BusinessDay businessDay) { return businessDayRepository.save(businessDay); } public BusinessDay updateBusinessDay(Long id, BusinessDay businessD..
-
6.23카테고리 없음 2023. 7. 21. 11:51
public class StoreController { private List stores = new ArrayList(); @GetMapping("/{storeId}/products") public List getStoreProducts(@PathVariable Long storeId) { Store store = findStoreById(storeId); if (store != null) { return store.getProducts(); } return new ArrayList(); } @PostMapping public Store addStore(@RequestBody Store store) { store.setId(generateStoreId()); stores.add(store); retur..
-
6.16카테고리 없음 2023. 7. 20. 17:29
def improved_recommendations(shop_id_list, indices, cosine_sim, shop_data): idx = list(indices[shop_id_list].values) sim_scores = [] for i in idx: sim_scores += list(enumerate(cosine_sim[i])) # 유사도가 높은 순으로 정렬 sim_scores = sorted(sim_scores, key=lambda x: x[1], reverse=True) # 유사도가 검사되는 자기 자신을 제외한 99개 상위 유사도 제한 data_indices = [i[0] for i in sim_scores] print(data_indices) # 중복되는 결과가 있는 경우 유사도가 더 ..
-
6.9-2카테고리 없음 2023. 7. 20. 16:58
# 총 문서(검색어)의 수 N = len(docs) def tf(t, d): return d.count(t) def idf(t): df = 0 for doc in docs: df += t in doc return log(N/(df+1)) def tfidf(t, d): return tf(t,d)* idf(t) result = [] # 아래 연산을 반복 for i in range(N): result.append([]) d = docs[i] for j in range(len(vocab)): t = vocab[j] result[-1].append(tf(t, d)) tf_ = pd.DataFrame(result, columns = vocab) result = [] for j in range(len(vocab)):..