Spaces:
Sleeping
Sleeping
Commit ·
93b3dfc
1
Parent(s): 57ca96a
Oracle weight assigning update
Browse files230 unmodified lines23123223323423523620 unmodified lines257258259260261262263264265266267268230 unmodified lines# logging.info(f"[INFO] Base weights assigned successfully in {end_time - start_time:.2f} seconds.")# return dfdef assign_base_weight(df, max_workers=32):"""Assign base weights using a single LLM call to determine feature weights,20 unmodified lines)try:response = llama.predict(prompt)feature_weights = eval(response) # Convert JSON string to dictionaryprint(f"[INFO] Feature weights from LLM: {feature_weights}", flush=True)except Exception as e:print(f"[ERROR] Failed to fetch feature weights from LLM: {e}", flush=True)logging.error(f"[ERROR] Failed to fetch feature weights from LLM: {e}")return df# Step 2: Programmatically calculate weights for each repositorydef calculate_weight(row):230 unmodified lines23123223323423523623723820 unmodified lines259260261262263264265266267268269270271272273274275276277278279280230 unmodified lines# logging.info(f"[INFO] Base weights assigned successfully in {end_time - start_time:.2f} seconds.")# return dfimport jsondef assign_base_weight(df, max_workers=32):"""Assign base weights using a single LLM call to determine feature weights,20 unmodified lines)try:response = llama.predict(prompt)feature_weights = json.loads(response) # Safely parse JSONprint(f"[INFO] Feature weights from LLM: {feature_weights}", flush=True)except (json.JSONDecodeError, Exception) as e:print(f"[ERROR] Failed to fetch feature weights from LLM: {e}", flush=True)logging.error(f"[ERROR] Failed to fetch feature weights from LLM: {e}")# Fallback to default weightsfeature_weights = {"stars": 0.3,"forks": 0.2,"watchers": 0.2,"open_issues": 0.1,"pulls": 0.1,"activity": 0.05,"contributors": 0.05}print(f"[INFO] Using default feature weights: {feature_weights}", flush=True)# Step 2: Programmatically calculate weights for each repositorydef calculate_weight(row):
Oracle/deepfundingoracle.py+15-3