Skip to content

Commit c6d552c

Browse files
committed
Updated styles and added filters
1 parent b84940a commit c6d552c

4 files changed

Lines changed: 679 additions & 28 deletions

File tree

.docs/latex/olko/README.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -463,15 +463,13 @@ useEffect(() => {
463463
const fetchData = async () => {
464464
const token = localStorage.getItem("access");
465465
if (token) {
466-
// Pobierz aktywny algorytm użytkownika
467466
const settingsResponse = await axios.get(
468467
`${config.apiUrl}/api/recommendation-settings/`,
469468
{ headers: { Authorization: `Bearer ${token}` } },
470469
);
471470
const algorithm =
472471
settingsResponse.data.active_algorithm || "collaborative";
473472

474-
// Pobierz rekomendacje dla algorytmu
475473
const response = await axios.get(
476474
`${config.apiUrl}/api/recommendation-preview/?algorithm=${algorithm}`,
477475
{ headers: { Authorization: `Bearer ${token}` } },
@@ -490,12 +488,10 @@ useEffect(() => {
490488
const fetchingAlgorithm = algorithmRequest.then((response) => {
491489
const algorithm = response.data.active_algorithm || "collaborative";
492490

493-
// Ustaw tytuł sekcji rekomendacji
494491
if (algorithm === "collaborative") {
495492
setRecommendationTitle("Recommended For You (Collaborative Filtering)");
496493
}
497494

498-
// Pobierz rekomendacje
499495
return axios.get(
500496
`${config.apiUrl}/api/recommendation-preview/?algorithm=${algorithm}`,
501497
{ headers: { Authorization: `Bearer ${token}` } },
@@ -1825,14 +1821,11 @@ def get(self, request):
18251821
const fetchRecommendations = async () => {
18261822
setRecommendationsLoading(true);
18271823
try {
1828-
// Zbierz ID produktów z koszyka
18291824
const productIds = Object.keys(items).filter((id) => items[id] > 0);
18301825

1831-
// Zbuduj query params
18321826
const params = new URLSearchParams();
18331827
productIds.forEach((id) => params.append("product_ids[]", id));
18341828

1835-
// Pobierz rekomendacje Apriori
18361829
const response = await axios.get(
18371830
`${config.apiUrl}/api/frequently-bought-together/?${params.toString()}`,
18381831
);
@@ -1845,7 +1838,6 @@ const fetchRecommendations = async () => {
18451838
}
18461839
};
18471840

1848-
// Wywoływane przy każdej zmianie koszyka
18491841
useEffect(() => {
18501842
if (Object.keys(items).length > 0) {
18511843
fetchRecommendations();
@@ -1994,13 +1986,11 @@ const fetchAssociationDebug = async (productId) => {
19941986
**Endpoint:** `GET /api/recommendation-preview/?algorithm={algorithm}`
19951987
19961988
```jsx
1997-
// Pobierz aktywny algorytm
19981989
const settingsResponse = await axios.get(
19991990
`${config.apiUrl}/api/recommendation-settings/`,
20001991
);
20011992
const algorithm = settingsResponse.data.active_algorithm || "collaborative";
20021993
2003-
// Pobierz rekomendacje
20041994
const response = await axios.get(
20051995
`${config.apiUrl}/api/recommendation-preview/?algorithm=${algorithm}`,
20061996
);
@@ -2015,7 +2005,6 @@ const response = await axios.get(
20152005
**Sekcja:** "Recommended For You"
20162006
20172007
```jsx
2018-
// Tytuł zmienia się zależnie od algorytmu
20192008
if (algorithm === "collaborative") {
20202009
setRecommendationTitle("Recommended For You (Collaborative Filtering)");
20212010
} else if (algorithm === "content_based") {
@@ -2036,7 +2025,6 @@ if (algorithm === "collaborative") {
20362025
**Endpoint:** `GET /api/frequently-bought-together/?product_ids[]={ids}`
20372026
20382027
```jsx
2039-
// Wyświetlanie metryk
20402028
<span className="stat-confidence">
20412029
Confidence: {(rec.confidence * 100).toFixed(0)}%
20422030
</span>

.docs/latex/smola/version1.tex

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2305,15 +2305,13 @@ \subsection*{6.6 Mechanizmy optymalizacji systemu}
23052305
Zamiast pojedynczych zapytań INSERT dla każdego podobieństwa, system wykorzystuje metodę \texttt{bulk\_create()} Django ORM do wstawiania rekordów wsadowo:
23062306

23072307
\begin{lstlisting}[style=pseudocode]
2308-
// Zamiast:
23092308
FOR kazda para (product1, product2):
2310-
ProductSimilarity.objects.create(...) // N zapytan SQL
2309+
ProductSimilarity.objects.create(...)
23112310

2312-
// System uzywa:
23132311
similarities = []
23142312
FOR kazda para (product1, product2):
23152313
similarities.append(ProductSimilarity(...))
2316-
ProductSimilarity.objects.bulk_create(similarities) // 1 zapytanie SQL
2314+
ProductSimilarity.objects.bulk_create(similarities)
23172315
\end{lstlisting}
23182316

23192317
Dla 4000 par produktów bulk insert jest \textbf{80x szybszy} niż pojedyncze inserty (5 sekund vs 400 sekund).

0 commit comments

Comments
 (0)