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
from bs4 import BeautifulSoup | |
import pandas as pd | |
with open('magiccon.html', 'r', encoding='utf-8') as file: | |
html_data = file.read() | |
soup = BeautifulSoup(html_data, 'html.parser') | |
# Initialize lists to store data | |
data = { | |
'Title': [], |
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
from segments.huggingface import release2dataset | |
from segments import SegmentsClient | |
dataset_identifier = "andrewljohnson/magic_cards" | |
release_name = "v0.1" | |
api_key = "HIDDEN" | |
client = SegmentsClient(api_key) # this is different from blog, blog seemed outdated | |
release = client.get_release(dataset_identifier, release_name) | |
hf_dataset = release2dataset(release) | |
from segments.utils import get_semantic_bitmap |
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
/* | |
Print out all ways for attackers to be blocked. blockAssignments maps ids of attackers to | |
vectors of defender ids for which blocks have already been chosen. defenders/defendersIterator specify | |
defenders that could block any of the attackers. This method iterates over all ways to choose blocks for | |
the remaining defenders. | |
example input: groupDefenders({0:[2 3] 1:[4 5]}, [6 7 8 9], 3) | |
output: |
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
/* | |
This method prints all possible blocks, recursively. | |
For example, if you have blockers A & B, and attacker C, there are three posible blocks. | |
No blockers: | |
A: | |
B: | |
C blocks A: |
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
void groupDefenders(vector<vector<int>> attackers, vector<int> defenders, int i) { | |
int x = 0; | |
for (vector<int> attackerBucket:attackers) { | |
cout << x << ": "; | |
for (int defender:attackerBucket) { | |
cout << defender << " "; | |
} | |
cout << "\n"; | |
x+= 1; | |
} |
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
#include <iostream> | |
#include <string> | |
#include <vector> | |
using namespace std; | |
// Current Cards | |
// Mountain | |
// Future Cards |
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
#include <iostream> | |
using namespace std; | |
// Current Cards | |
// Mountain | |
// Future Cards | |
// Forest | |
// Lightning Bolt, Giant Growth, Earthquake |
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 datetime | |
import math | |
import numpy as np | |
import pandas as pd | |
import pickle | |
import time | |
from django.db.models.functions import Cast | |
from django.db.models import IntegerField | |
from real_estate.models import AnalysisRecord |
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
root@8e3b54c9c353:/code# python manage.py shell < real_estate/scripts/generate_neural_net.py | |
fetching AnalysisRecords took 0.0015206336975097656 | |
Fetched 47555 records for properties. | |
2183530944 - Hashing AnalysisRecords took 3.006469964981079 | |
annotating years and months took 3.25303053855896 | |
making value map took 36.68412470817566 | |
Using 47550 properties for analysis. | |
4202095867 - data_hash | |
4036931971 - value_map_hash | |
making model took 0.8455119132995605 |
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
root@8e3b54c9c353:/code# python manage.py shell < real_estate/scripts/generate_neural_net.py | |
fetching AnalysisRecords took 0.0015499591827392578 | |
Fetched 15577 records for properties. | |
annotating years and months took 1.1473767757415771 | |
making value map took 11.682528972625732 | |
Using 15573 properties for analysis. | |
making model took 0.3301811218261719 | |
Model: "model" | |
__________________________________________________________________________________________________ | |
Layer (type) Output Shape Param # Connected to |
NewerOlder