quantecon / matchingmarkets.py Goto Github PK
View Code? Open in Web Editor NEWPython toolbox for simulation of matching markets in economics
License: BSD 3-Clause "New" or "Revised" License
Python toolbox for simulation of matching markets in economics
License: BSD 3-Clause "New" or "Revised" License
If verbose is True
when this code is run then NameError will be raised.
% flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
./matchingmarkets/algorithms/DA.py:103:52: F821 undefined name 'to_match_names_m'
iter_num, "\n\tTo Match males:", to_match_names_m,
^
./matchingmarkets/algorithms/DA.py:105:19: F821 undefined name 'to_match_names_f'
to_match_names_f)
^
2 F821 undefined name 'to_match_names_m'
2
Attempting to import MatchingMarkets in Google Codelab environment running Python 3.6 however getting the following error:
import matchingmarkets as mm
ImportError Traceback (most recent call last)
in ()
----> 1 import matchingmarkets as mm
2 #import matplotlib
3 #matplotlib.use('TKAgg')
4 frames
/usr/local/lib/python3.6/dist-packages/matplotlib/pyplot.py in switch_backend(newbackend)
234 "Cannot load backend {!r} which requires the {!r} interactive "
235 "framework, as {!r} is currently running".format(
--> 236 newbackend, required_framework, current_framework))
237
238 rcParams['backend'] = rcParamsDefault['backend'] = newbackend
ImportError: Cannot load backend 'Qt5Agg' which requires the 'qt5' interactive framework, as 'headless' is currently running
After doing some research on the error, it seems others have had similar error with matplotlib, though it is not clear if the suggested workaround would help in this case.
Any insights would be greatly appreciated.. or alternatively if you happen to have a clean install with MatchingMarkets already working somewhere in an online notebook/environment , please advise where it can be accessed. Thanks.
Some more hints in the README on how to pull in the dependencies and run this would be helpful.
So far this worked for me to avoid import errors:
pip install scipy networkx PyQt5
Then, since I don't see a pyproject.toml
or setup.py
, I just tried to run python from the root directory of the project, as cloned via git.
But I'm guessing that I'm getting different versions than you are, since I get these errors:
Python 3.8.0 (default, Oct 28 2019, 16:14:01)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import matchingmarkets as mm
>>> import numpy.random as rng
>>> newsim = mm.simulation(time_per_run=100, max_agents=5000, arrival_rate=15,typeGenerator=rng.randint,
compatFct=mm.stochastic_neighborSameType,crit_input=3, numTypes=5)
>>> newsim.graph(plot_time=0.8)
Attribute Qt::AA_EnableHighDpiScaling must be set before QCoreApplication is created.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/srv/s/games/MatchingMarkets.py/matchingmarkets/simulations.py", line 254, in graph
newMarket.update(metaAlgorithm=self.metaAlgorithm,
File "/srv/s/games/MatchingMarkets.py/matchingmarkets/market.py", line 393, in update
nx.draw_networkx_edges(self.Graph, self.graph_pos,
TypeError: draw_networkx_edges() got an unexpected keyword argument 'font_size'
>>>
It looks like I have networkx version 2.5.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.