- 4.1.1 Issues
Installed MongoDB using the following guide: Install MongoDB
However, the installation in the guide is for MongoDB 5.0
on WSL with Ubuntu 20.04 (focal)
distro.
The following is an adaptation of the guide for installing MongoDB 6.0
on WSL with Ubuntu 22.04 jammy
distro.
- Open your WSL terminal (ie. Ubuntu) and go to your home directory::
cd ~
- Update your Ubuntu packages:
sudo apt update
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from sklearn.utils import shuffle | |
from pysad.models import IForestASD | |
from pysad.transform.preprocessing import InstanceUnitNormScaler | |
from pysad.transform.postprocessing import RunningAveragePostprocessor | |
from pysad.utils import Data | |
from pysad.evaluation import AUROCMetric | |
from pysad.utils.array_streamer import ArrayStreamer | |
from tqdm import tqdm | |
import pandas as pd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person(object): | |
def __init__(self, name): | |
print('Instantiating a person') | |
self.name = name | |
def __str__(self): | |
return self.name | |
def say_selam(p=Person('Nebiyu')): | |
print(f'Selam {p}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I'm calling the function without providing a value for the | |
# paused_at parameter | |
item.pause_item(request.user) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def pause_item(self, user=None, paused_at=timezone.now()): | |
self.set_paused_at(paused_at) | |
self.set_paused_by(user) | |
self.set_is_paused(True) | |
return self.get_paused_at() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_overall_score_trending_factor_queryset(self, queryset): | |
duration = Epoch((F('now') - F('created_at'))) | |
queryset = queryset.annotate( | |
now=Cast(timezone.now(), DateTimeField()), | |
duration=duration, | |
trending_factor=ExpressionWrapper( | |
# the 10 ^ 6 * 3600 * 24 * 30 multiplication is to convert micro second duration to months | |
(F('score__overall_score') * 1_000_000 * 3600 * 24 * 30) / F('duration'), | |
output_field=DecimalField() |