Skip to content

Commit

Permalink
Add test for EVP. Set training matrix to identity for equal results o…
Browse files Browse the repository at this point in the history
…n each execution with dummy data.

Signed-off-by: Felix Zailskas <[email protected]>
  • Loading branch information
felix-zailskas committed Nov 3, 2023
1 parent f0cb2d5 commit 8928ed4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/evp/evp.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def __init__(self) -> None:
self.life_time_value_predictor = LinearRegression()

all_leads = get_database().get_all_leads()
X = np.random.random((len(all_leads), len(all_leads)))
X = np.identity(len(all_leads))
y_probability = np.array(
[lead.lead_value.customer_probability for lead in all_leads]
)
Expand Down
19 changes: 19 additions & 0 deletions tests/test_evp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: 2023 Felix Zailskas <[email protected]>

import os
import sys

sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "src")))

from database import get_database
from database.models import LeadValue
from evp.evp import EstimatedValuePredictor


def test_estimate_value():
leads = get_database().get_all_leads()
evp = EstimatedValuePredictor()
for lead in leads:
value = evp.estimate_value(lead.lead_id)
assert type(value) == LeadValue

0 comments on commit 8928ed4

Please sign in to comment.