Version: 2002-Dec-09
Copyright © 1997-2002 International Business Machines Corporation and
others. All Rights Reserved.
Today's software market is a global one in which it is desirable to develop and maintain one application (single source/single binary) that supports a wide variety of languages. The International Components for Unicode (C/C++) provides tools to help write platform-independent applications that are internationalized and localized, with support for:
ICU has a sister project ICU4J that extends the internationalization capabilities of Java to a level similar to ICU. The ICU C/C++ project is also called ICU4C when a distinction is necessary.
This document describes how to build and install ICU on your machine.
For other information about ICU please see the following table of
links.
The ICU homepage also links to related information about writing
internationalized software.
| ICU Homepage | http://oss.software.ibm.com/icu/ |
| ICU4J Homepage | http://oss.software.ibm.com/icu4j/ |
| FAQ - Frequently Asked Questions about ICU | http://oss.software.ibm.com/icu/userguide/icufaq.html |
| ICU User's Guide | http://oss.software.ibm.com/icu/userguide/ |
| Download ICU Releases | http://oss.software.ibm.com/icu/download/ |
| API Documentation Online | http://oss.software.ibm.com/icu/apiref/ |
| Online ICU Demos | http://oss.software.ibm.com/icu/demo/ |
| Contacts and Bug Reports/Feature Requests | http://oss.software.ibm.com/icu/archives/ |
Important: Please make sure you understand the Copyright and License Information.
The following list concentrates on changes that affect existing applications migrating from previous ICU releases. For more news about this release, see the ICU 2.4 download page.
ICU 2.4 changes the behavior of the UnicodeString
assignment operator and copy constructor for where the source string is a
readonly alias. For such strings, the copy used to also be a readonly alias
to the same buffer, but that was seen as too dangerous (see Jitterbug 2296). The
new fastCopyFrom()
member function provides the old assignment
behavior. It can be used explicitly when it is known to be safe to maintain
readonly aliases instead of cloning the buffer. For more information about
string aliasing and other UnicodeString
storage models see the
User Guide
Strings chapter.
The macros in source/common/unicode/utf*.h
have been
revamped, improved, simplified, and renamed. The old macros continue to be
available. They are in utf_old.h
, together with an explanation
of the change. utf.h
, utf8.h
and
utf16.h
contain the new macros instead. The new macros are
intended to be more consistent, more useful, and less confusing. Some
macros were simply renamed for consistency with a new naming scheme.
A related change is that UChar32
is not a
platform-dependent type any more, but is now always defined to be the same
as int32_t
. This allows for consistent, more portable code and
C++ function overloading as well as negative values as sentinels on all
platforms. See the definition in utf.h
.
ICU code libraries can be made smaller by removing functionality. See How to Make ICU Smaller.
Unicode properties and algorithms have been upgraded to Unicode 3.2, which includes the addition of more than 1000 new encoded characters. The UCA (Unicode Collation Algorithm) table is updated to the current version 3.1.1, with Unicode 3.2-based canonical closure. All Unicode properties (except for those in Unihan.txt) are now available via direct APIs, and most via UnicodeSet.
New converter implementations are added for:
ICU 2.2 has an extended search path functionality, more flexible data override capabilities, and removes lesser-known heuristics for determining the data path.
Note: while some of the old binary data may be still readable by ICU 2.2 (resource bundles, for example), they need to be repackaged in order to be used.
'packagename_'
. Then use
packagename
for opening.ICU 2.2 libraries do not use the global operators new and delete. Instead, all C++ classes are derived from a common base class UObject which implements new and delete operators for all of ICU's C++ classes. Users can customize the ICU memory allocation by changing the functions in source/common/cmemory.c that are used for non-class types and in UObject's new and delete operators.
This also means that ICU libraries may safely use a different heap than the application because all memory is consistently allocated and released from within the libraries. On Windows it is now possible to link the application with, for example, the static C runtime library even though ICU libraries use the DLL-based runtime.
Experimental locales are ones for which we have incomplete data. Data for such locales used to be included in the default ICU download, but have been moved to a new locale data repository, stored as another ICU CVS module. This data can be added back into a customized ICU build, see the User Guide Data chapter. It can also still be viewed with the LocaleExplorer demo.
There are two ways to download ICU releases:
In the descriptions below, <ICU> is the
full path name of the icu directory (the top level directory from the
distribution archives) in your file system. You can also view the User's Guide to
see which libraries you need for your software product. You need at least
the data ([lib]icudt
) and the common ([lib]icuuc
)
libraries in order to use ICU.
| File | Description |
|---|---|
| readme.html | Describes the International Components for Unicode (this file) |
| license.html | Contains the text of the ICU license |
| Directory | Description |
|---|---|
| <ICU>/source/common/ | The core Unicode and support functionality, such as resource bundles, character properties, locales, codepage conversion, normalization, Unicode properties, Locale, and UnicodeString. |
| <ICU>/source/i18n/ | Modules in i18n are generally the more data-driven, that is to say resource bundle driven, components. These deal with higher-level internationalization issues such as formatting, collation, text break analysis, and transliteration. |
| <ICU>/source/data/ |
This directory contains the source data in text format, which is
compiled into binary form during the ICU build process. It contains
several subdirectories, in which the data files are grouped by
function. Note that the build process must be run again after any
changes are made to this directory.
|
| <ICU>/source/test/intltest/ | A test suite including all C++ APIs. For information about running the test suite, see the users' guide. |
| <ICU>/source/test/cintltst/ | A test suite written in C, including all C APIs. For information about running the test suite, see the users' guide. |
| <ICU>/source/test/testdata/ | Source text files for data, which are read by the tests. It contains the subdirectories out/build/ which is used for intermediate files, and out/ which contains the files test1.cnv through test4.cnv, and testdata.dat. Note that the tests call u_setDataDirectory("<ICU>/source/test/testdata/lib"), so that ICU will load these files as if they were part of the ICU data package, for testing purposes. This was formerly accomplished by setting the ICU_DATA environment variable to point at these files. ICU_DATA should not be set under normal circumstances. |
| <ICU>/source/tools/ | Tools for generating the data files. Data files are generated by invoking <ICU>/source/data/build/makedata.bat on Win32 or <ICU>/source/make on Unix. |
| <ICU>/source/samples/ | Various sample programs that use ICU |
| <ICU>/source/extra/ | Non-supported API additions. Currently, it contains the 'ustdio' file i/o library |
| <ICU>/source/layout/ | Contains the ICU layout engine (not a rasterizer). |
| <ICU>/packaging/ <ICU>/debian/ |
These directories contain scripts and tools for packaging the final ICU build for various release platforms. |
| <ICU>/source/config/ | Contains helper makefiles for platform specific build commands. Used by 'configure'. |
| <ICU>/source/allinone/ | Contains top-level ICU workspace and project files, for instance to build all of ICU under one MSVC project. |
| <ICU>/bin/ | Contains the libraries and executables for using ICU on Windows. |
| <ICU>/include/ | Contains the headers needed for developing software that uses ICU on Windows. |
| Operating system | Compiler | Testing frequency |
|---|---|---|
| Windows NT/2000/XP | Microsoft Visual C++ 6.0 | Reference platform |
| Red Hat Linux 7.2 | gcc 2.96 | Reference platform |
| AIX 5.1.0 L | Visual Age C++ 5.0 | Reference platform |
| Solaris 7 (SunOS 5.7) | Workshop Pro CC 6.0 | Reference platform |
| HP/UX 11.01 | aCC A.12.10 | Reference platform |
| Windows 98 | Microsoft Visual C++ 6.0 | Regularly tested |
| AIX 4.3.3 | xlC_r 3.6.6 | Regularly tested |
| Solaris 8 (SunOS 5.8) | Workshop Pro CC 4.2 (use 'runConfigureICU SOLARISCC/W4.2') |
Regularly tested |
| Solaris 2.6 (SunOS 5.6) | gcc 2.95.2 | Regularly tested |
| FreeBSD 4.4 | gcc 2.95.3 | Regularly tested |
| Mac OS X (10.1) | gcc-932.1, based on gcc version 2.95.2 (Developer Tools December 2001) |
Regularly tested |
| z/OS 1.2 | cxx 1.2 | Regularly tested |
| HP/UX 11.01 | CC A.03.10 | Rarely tested |
| AS/400 (iSeries) V5R1 | iCC | Rarely tested |
| NetBSD, OpenBSD | Rarely tested | |
| SGI/IRIX | Rarely tested | |
| Tru64 (OSF) | Compaq's cxx compiler | Rarely tested |
Key to testing frequency
Building International Components for Unicode requires:
(If you want to build with Microsoft Visual C++ .NET, please refer to the note about building with Visual Studio .NET below.)
The steps are:
Using MSDEV At The Command Line Note: You can build ICU from the command line. Assuming that you have properly installed Microsoft Visual C++ to support command line execution, you can run the following command, 'msdev <ICU>\source\allinone\allinone.dsw /MAKE "ALL"'.
Setting Active Configuration Note: To set the active configuration, two different possibilities are:
Batch Configuration Note: If you want to build the Debug and Release configurations at the same time, choose "Build" menu and select "Batch Build..." instead (and mark all configurations as checked), then click the button named "Rebuild All". The "all" workspace will build all the libraries, test programs and various ICU tools (e.g. genrb for generating binary locale data files).
Microsoft Visual Studio .NET Note: ICU will build with Microsoft Visual Studio .NET, though this is not a supported platform at the time of this writing. Visual Studio .NET will offer to convert the project files when you open the existing workspace file. Choose "Yes to All" in the dialog asking whether to convert the files or not (this creates new files) and then follow the rest of the build instructions.
Building International Components for Unicode requires:
The steps are:
Building International Components for Unicode on Unix requires:
Here are the steps to build ICU:
Configuring ICU NOTE: Type "./runConfigureICU --help" for help on how to run it and a list of supported platforms. You may also want to type "./configure --help" to print the available configure options that you may want to give runConfigureICU. If you are not using the runConfigureICU script, or your platform is not supported by the script, you may need to set your CC,CXX, CFLAGS and CXXFLAGS environment variables, and type "./configure". Some of the more frequently used options to configure are --disable-64bit-libs to create 32-bit libraries, and --srcdir to do out of source builds (build the libraries in the current location).
Running The Tests From The Command Line NOTE: You may have to set certain variables if you with to run test programs individually, that is apart from "make check". The TZ environment variable needs to be set to PST8PDT. Also, the environment variable ICU_DATA can be set to the full pathname of the data directory to indicate where the locale data files and conversion mapping tables are when you are not using the shared library (e.g. by using the .dat archive or the individual data files). The trailing "/" is required after the directory name (e.g. "$Root/source/data/" will work, but the value "$Root/source/data" is not acceptable). You do not need to set ICU_DATA if the complete data library is in your library path.
Installing ICU NOTE: If you are using the "gmake install" command, using the "--prefix" option on configure or runConfigureICU will install ICU to the specified location.
Some platforms use package management tools to control the installation and uninstallation of files on the system, as well as the integrity of the system configuration. You may want to check if ICU can be packaged for your package management tools by looking into the "packaging" directory. (Please note that if you are using a snapshot of ICU from CVS, it is probable that the packaging scripts or related files are not up to date with the contents of ICU at this time, so use them with caution).
You can install ICU on z/OS or OS/390 (the previous name of z/OS), but IBM tests only the z/OS installation. These platforms commonly are called "MVS". You install ICU in a z/OS UNIX system services file system such as HFS or zFS. On this platform, it is important that you understand a few details:
z/OS supports both native S/390 hexadecimal floating point and,
(with OS/390 2.6 and later) IEEE binary floating point. This is a
compile time option. Applications built with IEEE should use ICU dlls
that are built with IEEE (and vice versa). The environment variable
IEEE390=1 will cause the z/OS version of ICU to be built with IEEE
floating point. The default is native hexadecimal floating point.
Important: Currently (ICU 1.4.2), native floating point
support is sufficient for codepage conversion, resource bundle and
UnicodeString operations, but the Format APIs, especially ChoiceFormat,
require IEEE binary floating point.
Examples for configuring ICU:
Debug build: IEEE390=1 ./runConfigureICU --enable-debug
zOS/cxx
Release build: IEEE390=1 ./runConfigureICU zOS/cxx
By default, ICU builds its libraries into the UNIX file system (HFS). In addition, there is a z/OS specific environment variable (OS390BATCH) to build some libraries into the z/OS native file system. This is useful, for example, when your application is externalized via Job Control Language (JCL).
The OS390BATCH environment variable enables non-UNIX support including the batch environment. When OS390BATCH is set, the libicuucXX.dll, libicudtXXe.dll, and libicudtXXe_stub.dll binaries are built into data sets (the native file system). Turning on OS390BATCH does not turn off the normal z/OS UNIX build. This means that the The z/OS UNIX (HFS) dlls will always be created.
Two additional environment variables indicate the names of the z/OS data sets to use. The LOADMOD environment variable identifies the name of the data set that contains the dynamic link libraries (DLLs) and the LOADEXP environment variable identifies the name of the data set that contains the side decks, which are normally the files with the .x suffix in the UNIX file system.
A data set is roughly equivalent to a UNIX or Windows file. For most kinds of data sets the operating system maintains record boundaries. UNIX and Windows files are byte streams. Two kinds of data sets are PDS and PDSE. Each data set of these two types contains a directory. It is like a UNIX directory. Each "file" is called a "member". Each member name is limited to eight bytes, normally EBCDIC.
Here is an example of some environment variables that you can set prior to building ICU:
OS390BATCH=1 LOADMOD=USER.ICU.LOAD LOADEXP=USER.ICU.EXP
The PDS member names for the DLL file names are as follows:
IXMIXXUC --> libicuucXX.dll IXMIXXDA --> libicudtXXe.dll IXMIXXD1 --> libicudtXXe_stub.dll (Only when OS390_STUBDATA=1)
You should point the LOADMOD environment variable at a partitioned data set extended (PDSE) and point the LOADEXP environment variable at a partitioned data set (PDS). The PDSE can be allocated with the following attributes:
Data Set Name . . . : USER.ICU.LOAD Management class. . : **None** Storage class . . . : BASE Volume serial . . . : TSO007 Device type . . . . : 3390 Data class. . . . . : LOAD Organization . . . : PO Record format . . . : U Record length . . . : 0 Block size . . . . : 32760 1st extent cylinders: 1 Secondary cylinders : 5 Data set name type : LIBRARY
The PDS can be allocated with the following attributes:
Data Set Name . . . : USER.ICU.EXP Management class. . : **None** Storage class . . . : BASE Volume serial . . . : TSO007 Device type . . . . : 3390 Data class. . . . . : **None** Organization . . . : PO Record format . . . : FB Record length . . . : 80 Block size . . . . : 3200 1st extent cylinders: 3 Secondary cylinders : 3 Data set name type : PDS
ICU Reference Release 2.4 contains partial support for the iSeries platform. After building ICU and running the tests, you may notice that some of the formatting tests fail. The formating failures can be ignored for now. These failures are expected to be resolved in a future release of ICU.
The following describes how to setup and build ICU.
CRTLIB LIB(libraryname)
ADDENVVAR ENVVAR(CC) VALUE('/usr/bin/icc') ADDENVVAR ENVVAR(CXX) VALUE('/usr/bin/icc') ADDENVVAR ENVVAR(MAKE) VALUE('/usr/bin/gmake') ADDENVVAR ENVVAR(OUTPUTDIR) VALUE('libraryname') ADDENVVAR ENVVAR(QIBM_MULTI_THREADED) VALUE('Y')libraryname identifies target as400 library for *module, *pgm and *srvpgm objects. The QIBM_MULTI_THREADED environment variable is only needed for the multithreaded tests to pass.
DSPSYSVAL SYSVAL(QUTCOFFSET)
CHGSYSVAL SYSVAL(QUTCOFFSET) VALUE('-0800')You should change -0800 to -0700 for daylight savings.
If you are using ICU in a multithreaded application, there may be a chance that the ICU global mutex is not initialized properly. Normally the ICU global mutex is initialized during C++ static initialization, but there are some compilers and linkers that do not properly perform C++ static initialization in a library (this sometimes happens on HP/UX and on MacOS X).
Upon the first usage of most ICU APIs, the global mutex will get initialized. For example, you could call uloc_countAvailable() or uloc_getDefault() from your main() function before any threads are created. Those functions will initialize the global mutex. Without one of these function calls from a single thread, the data caches inside ICU may get initialized more than once, which may cause memory leaks and other problems. This problem normally does not happen when C++ static initialization works properly.
ICU does not use C++ static initialization for anything else, and disabling threads in ICU will disable all C++ static initialization in ICU.
For some environments, ICU "is too large". There are two ways to remove parts and make it smaller: Remove some of its library code modules from the build (reducing functionality), or remove some of its data (possibly reducing only codepage/locale/etc. coverage without sacrifycing overall functionality). For details about reducing the data size see the User Guide "ICU Data" chapter.
The header file source/common/unicode/uconfig.h
contains
source-code-level "switches" corresponding to #if
directives
in the ICU source code. Setting one of the UCONFIG_NO_...
switches to 1 (by setting CFLAGS/CPPFLAGS
or adding a
#define
at the beginning of uconfig.h
) turns off
the code associated with one of the ICU service modules. Setting one of the
UCONFIG_ONLY_...
switches to 1 turns off all modules that are
not essential for the functioning of the associated "only" service. For the
current set of available switches see uconfig.h
itself.
When a source code module is turned off, then the data-building
makefiles should be modified to not generate the data files that are used
with that module. Some of the data-generating genxyz tools rely on the
module itself to build its data; they will generate dummy data files to
satisfy the dependencies of the unmodified makefiles (to make these
switches easily testable). Other data files for which the tools do not rely
on the related library modules (e.g., mapping tables [.cnv
]
and transliterator files [.res
, from
source/data/translit/
]) continue to be built unless the data
makefiles are modified. For further details on data building see the User Guide "ICU Data"
chapter.
Even though the ICU development team tries to make a stable API, some breaking changes are required from time to time. ICU does not guarentee binary compatibility of its functions or its data between releases. Please view the ICU Design chapter of the User's Guide for details.
If you are building on the Win32 platform, it is important that you understand a few of the following build details.
As delivered, the International Components for Unicode build as several DLLs, which are placed in the "<ICU>\bin" directory. You must add this directory to the PATH environment variable in your system, or any executables you build will not be able to access International Components for Unicode libraries. Alternatively, you can copy the DLL files into a directory already in your PATH, but we do not recommend this. You can wind up with multiple copies of the DLL and wind up using the wrong one.
Note: When packaging a Windows application for distribution and installation on user systems, copies of the ICU DLLs should be included with the application, and installed for exclusive use by the application. This is the only way to insure that your app is running with the same version of ICU, built with exactly the same options, that you developed and tested with. Refer to Microsoft's guidelines on the usage of DLLs, or search for the phrase "DLL hell" on msdn.microsoft.com.
All the DLLs link with the C runtime library "Debug Multithreaded DLL"
or "Multithreaded DLL." (This is changed through the Project Settings
dialog, on the C/C++ tab, under Code Generation.) It is important that any
executable or other DLL you build which uses the International Components
for Unicode DLLs links with these runtime libraries as well. If you do not
do this, you will get random memory errors when you run the executable.
If you are building on a Unix platform, and if you are installing ICU in a non-standard location, you may need to add the location of your ICU libraries to your LD_LIBRARY_PATH or LIBPATH environment variable (or the equivalent runtime library path environment variable for your system). The ICU libraries may not link or load properly without doing this.
Note that if you do not want to have to set this variable, you may instead use the --enable-rpath option at configuration time. This option will instruct the linker to always look for the libraries where they are installed. You will need to use the appropriate linker options when linking your own applications and libraries against ICU, too. Please refer to your system's linker manual for information about runtime paths. The use of rpath also means that when building a new version of ICU you should not have an older version installed in the same place as the new version's installation directory, as the older libraries will used during the build, instead of the new ones, likely leading to an incorrectly build ICU. (This is the proper behavior of rpath.)
ICU has code to determine the default codepage of the system or process.
This default codepage can be used to convert char *
strings to
and from Unicode.
Depending on system design, setup and APIs, it may not always be possible to find a default codepage that fully works as expected. For example,
char *
encodings there are two classes, called "ANSI" and "OEM" codepages. ICU
will use the ANSI codepage. Note that the OEM codepage is used by default
for console window output.If you have means of detecting a default codepage name that are more
appropriate for your application, then you should set that name with
ucnv_setDefaultName()
as the first ICU function call. This
makes sure that the internally cached default converter will be
instantiated from your preferred name.
Starting in ICU 2.0, when a converter for the default codepage cannot be opened, a fallback default codepage name and converter will be used. On most platforms, this will be US-ASCII. For z/OS (OS/390), ibm-1047-s390 is the default fallback codepage. For AS/400 (iSeries), ibm-37 is the default fallback codepage. This default fallback codepage is used when the operating system is using a non-standard name for a default codepage, or the converter was not packaged with ICU. The feature allows ICU to run in unusual computing environments without completely failing.
The platform dependencies have been mostly isolated into the following files in the common library. This information can be useful if you are porting ICU to a new platform.
It is possible to build each library individually. They must be built in
the following order:
Copyright © 1997-2002 International Business Machines Corporation
and others. All Rights Reserved.
IBM Globalization Center of Competency - San Jose,
5600 Cottle Road, San José, CA 95193
All rights reserved.


Chapter 3. Fourier Analysis and Experiments
Section 3.7.3. Example: STFT, Filter, Inverse STFT
Section 3.7.4. Phase Spectrogram of STFT
Spectrogram 1
Spectrogram 2
Chapter 4. Azimuth Discrimination and Resynthesis (ADRess)
Section 4.7. Experiments
The input signal is a four-note melody with 4 sources of the synthetic clarinet. All notes are one second long.
-
Left ChannelStereo MixRight Channel
-
TruthRecoveredSopranoAltoTenorBass
-
Spectrograms
The input signal is a four-note melody with 4 sources of the synthetic clarinet. All notes are one second long.
-
Left ChannelStereo MixRight Channel
-
TruthRecoveredMelodyAltoBass
-
Spectrograms
Extra. Alienesque background noise
Alienesque noises can be heard more clearly when extracting an azimuth subspace with no dominant source. This noise is still present in normal extractions when the subspace is chosen to be too wide.
Chapter 5. Evaluation
Source Separation Demo on the URMP Dataset
The first 15 seconds of four pieces from the URMP dataset are presented here. All demos feature strings, which allows for a comparison in the separation quality.
Piece 1 (Two Instruments)
Piece 12 (Three Instruments)
Piece 24 (Four Instruments)
Piece 39 (Five Instruments)
Transcription Demo on the URMP Dataset
The separated tracks were then individually transcribed using AnthemScore. In the following examples, tracks with time alignment issues are marked with an asterisk (*) in the score. These tracks have been manually aligned in order for the transcription to sound more uniform.
 Qualitative Results and Discussion
Some quality issues in the separation, the URMP dataset, and the transcriptions were pointed out in this section in the report. Selected sections of the mentioned examples are presented here.
-
Subspace width
The timbre components (harmonic overtones) from the other parts has seeped into the extraction of the second flute in Piece 30 at 50 seconds due to an overly wide subspace width H.
-
Same note from different instruments
When two instruments play the same note (not necessarily at the same octave), their harmonic overtones overlap. Thus, the same frequency bands have energy at different azimuth positions, causing the nulltoe shift between them. This happens most noticeably in Piece 40, at 20 seconds: the oboe plays a C4 quietly, whereas the bassoon plays a C3 loudly. Consequently, this section in the recovered bassoon sounds somewhat muted due to this extra energy in its harmonic overtone C4. In contrast, this melody in the extracted oboe track sounds as quiet as the background noise. Immediately after this, at 21 seconds, all parts are muted except the oboe, and thus it is clearly extracted and demonstrates a big contrast to the previously muffled sound.
OboeBassoon -
Trills
Trills in the dataset are explicitly written out as sixteen triplets (for example, in Piece 4).
-
Expressive Timings
Expressive timings were not denoted in the music score but were performed. For example, the ritardando ending in Piece 10 or the gradual accelerando in Piece 26.
Piece 10Piece 26 -
Performance Errors
There were performance errors, such as the trombone in Piece 33 at 27 seconds.


This is something that comes up a lot which I can never seem to remember. I don't want to configure a new website every time I want to treat a directory like a site.
C:>cd "C:\Program Files (x86)\IIS Express"
C:\Program Files (x86)\IIS Express>iisexpress.exe /path:{path_to_directory} /port:{portnumber}
C:\Program Files (x86)\IIS Express>iexplore "http://localhost:{portnumber}"


Checkout
Shopping Cart Amount:
Total Tax Amount:
Total Shipping Amount:
Total Amount Due:
Payment type:
VISA
MC
AMEX
Card Number:
Card Expiration (MM/YYYY):
I agree and authorize the amount to be charged to my credit card.


Tests of association between SNPs or pairs of SNPs and binary phenotypes, in case-control / case-population / case-control-population studies.
| Version: | 1.0 |
| Depends: | nloptr |
| Published: | 2014-03-24 |
| Author: | Shachar Kaufman |
| Maintainer: | Shachar Kaufman <shachark at post.tau.ac.il> |
| License: | GPL-2 |
| NeedsCompilation: | no |
| CRAN checks: | CCpop results |
| Reference manual: | CCpop.pdf |
| Package source: | CCpop_1.0.tar.gz |
| Windows binaries: | r-devel: CCpop_1.0.zip, r-release: CCpop_1.0.zip, r-oldrel: CCpop_1.0.zip |
| OS X binaries: | r-release: CCpop_1.0.tgz, r-oldrel: CCpop_1.0.tgz |
Please use the canonical form https://CRAN.R-project.org/package=CCpop to link to this page.


HTML5, CSS3
JavaScript
You can learn more about HTML and CSS by viewing these decks and documents:
Deck > HTML Part 1: http://bit.ly/QwLhc8
Deck > HTML Part 2: http://bit.ly/PEc6bG
Deck > JavaScript: http://bit.ly/OPDg3s
Deck > Eclipse: http://bit.ly/VPK2UE
Doc > HTML: http://www.elvenware.com/charlie/development/web/HtmlGuide/GettingStarted.html
Doc > JavaScript: http://www.elvenware.com/charlie/development/web/JavaScript/Basics.html
Doc > Eclipse: http://www.elvenware.com/charlie/development/android/Eclipse.shtml
NOTE: You will have to be patient with the documents you find on Elvenware. Someday they will mature, but for now, they are a work in progress. Don't expect anything fully polished, just take what you can get from them. One thing they do provide, is a good sense of what I think is important. Generally material that is assigned as homework is addressed somewhere on Elvenware.
We will also introduce our primary IDEs, which include:
Visual Studio
NotePad++
SkyDrive
Google Drive
DropBox
Ubuntu
GitHub
Mercurial
I have a number of videos that you should watch:
http://www.youtube.com/user/charliecalvert
Douglas Crockford on JavaScript:
http://www.youtube.com/watch?v=hQVTIJBZook
The goals for today are to:
Get running with Aptana and Eclipse
Learn how to create a JavaScript module
Learn how to create a button, click on it, and call a JavaScript method.
Learn jQuery basics
In FireFox, install FireBug:
IE can sometimes turn on compatibility settings, particular on Intranets, even though our code is fully HTML 5 compliant. To stop this:
<!-- Turn off compatibility settings in IE -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
http://www.elvenware.com/charlie/development/web/JavaScript/JQueryBasic.html
http://www.elvenware.com/charlie/development/web/HtmlGuide/GettingStarted.html#mso9
<script src="http://code.jquery.com/jquery.min.js" type="text/javascript"></script>


Here, we can help you find out how people feel about the keyword you type in 50 states of US
I am interestedType in any key word you like
Does our project mean something to you? That's great! Send us an email about any questions for our project and code and we will get back to you as soon as possible!
Ning Wang
Shiyu Xie
Feng Han
Xing Feng
Yue Liu


---
layout: default
---
Meta
- Most Popular AI Websites Sorted By Monthly Traffic [link]
- Import csv and ask questions about data [link]
- LangChain, a framework for developing applications powered by LLMs
- AI Hype Wall of Shame
Prompts
- Prompt libraries: Snack Prompt, Prompt Vibes
- You can ask for output in markdown format for better readability.
- "Distill the most important lessons from {Book Title} into a comprehensive, but digestible summary."
- "[Paste Your Writing].Proofread the above text for spelling and grammar. Make the sentences more clear."
- Exampleof writing an economics blog using GPT4
Applications
Academia
Lifestyle
Automata
Others


[gecode-users] ps.uni-sb.de is back online
Guido Tack
tack at ps.uni-sb.de
Mon May 29 17:32:32 CEST 2006
Hi everyone.
Due to a hard disk failure, our server hasn't been fully available since last
weekend. We have replaced the disk now and recovered its contents from last
night's backup.
Fortunately, this disk contained only the /services (or /srv) mountpoint,
which means that home directories were not affected. We hope that the system
will run more stable now and apologize for any inconvenience.
Cheers,
Guido
--
Guido Tack
Programming Systems Lab, Saarland University, Germany
http://www.ps.uni-sb.de/~tack
More information about the gecode-users
mailing list


Exercise 1
Adventure Commitment Community Creativity Excitement Friendships Growth Inspiration Integrity Loyalty Music Nature Peace Physical challenge Truth Vibrancy Wisdom
Exercise 2
Community is fundamental to the human experience. Strong social bonds and the ability to trust one another are critically important.
Exercise 3
5, I agree.
Exercise 4
I am not sure what the last topic that someone asked for my advice on was.


--- layout: archive title: Zulip Chat Archive permalink: /stream/113488-general/topic/Problem.20with.20type.20class.20search.html ---
Question: how much instances of decidable (fin n)
are found by Lean? And why does it matter? Answer: https://github.com/johoelzl/tc-log-parser/blob/master/problem.md#answer
fin n
is just an example, even decidable
is not the problem in itself. The problem will happen with each diamond where we have two ways to construct the same instance.
It looks like this is something we cannot solve in mathlib, but requires changes in Lean. @Sebastian Ullrich: the type class search in Lean 4 will be the same as in Lean 3? So it would make sense to improve it in Lean 3 and then port it to Lean 4?
Semantically it will probably stay the same, but Leo wants to look into possible optimizations. I will note this as one potential optimization opportunity, thanks for the write-up. No promises though.
Good to hear!
@Johannes Hölzl Could you tell us more about this repository?
@Sebastian Ullrich I think you should ask @Cyril Cohen about ideas to improve the type class search semantic. In Amsterdam he told several things that got added to Coq recently and seemed like they could be very useful for large scale type class search
The idea is to have a parser for the log produced by Lean when searching for type class instances. All it currently does is to outpute the computed instances until a mark ff
instance is looked up. This was the essential information I needed.
But I'm sure it can be used to analyse other problems too
Hm, this problem seams to be even worse: is_add_monoid_hom (coe : ℤ → ℤ)
does not terminate. Now is_ring_hom (coe : ℤ → ℤ)
doesn't work due to some unification problems. But is_ring_hom.is_semiring_hom
is_semiring_hom.is_add_monoid_hom
is looking for a ring
instance and then for the is_ring_hom
instance. The is_ring_hom
instance is not found, hence it starts to enumerate all the ways to construct ring
for int
.
Maybe a solution would be to annotate class
constants with a attribute, saying that there should be no backtracking, i.e. there should be only one canonical instance.
Maybe a solution would be to annotate
class
constants with a attribute, saying that there should be no backtracking, i.e. there should be only one canonical instance.
Isn't this how type class search is supposed to work anyway. So we can just bake that assumption in. If you found an instance, and it didn't work, just stop. No need to look for another instance.
Right, it should be the default behaviour.
Or even not configurable
@Paul-Nicolas Madelaine and I came across a problem that I've seen before. Because of left-to-right elaboration, Lean won't coerce n
to ℤ
here:
import data.int.basic example (n : ℕ) (z : ℤ) : n < z := sorry
Instead, it decides that <
is over ℕ
and tries to coerce z
. This should fail, but in practice it times out. I've noticed this many times but never had a chance to investigate. Turns out this is is another instance of the same type class issue Johannes reports. int.cast_coe
looks, in order, for has_zero ℕ
, has_one ℕ
, has_add ℕ
, and has_neg ℕ
. There are tons of paths to the first three. (Presumably. I didn't count.) The last one fails. So the search goes effectively forever.
There's an easy solution for this particular case, though: change int.cast_coe
to look for has_neg
first. Then it fails fast. Nothing in mathlib breaks with this change. (I didn't compare compilation times.) This points to a general design strategy, as long as type class inference has this behavior: put the hardest (rarest, least likely) classes as early as possible.
Good idea. I'll try to keep it in mind while writing code.
So today will be remembered as the day that the age old question of why Lean times out when failing to coerce from int to nat is solved! @Johannes Hölzl @Sebastian Ullrich this trips up beginner mathematicians and is hard for them to debug. I think Johannes has found a fundamental issue which needs some serious thought.
So what Rob is saying, I think, is that in data.int.basic
in mathlib, one of the lines here
section cast variables {α : Type*} section variables [has_zero α] [has_one α] [has_add α] [has_neg α] /-- Canonical homomorphism from the integers to any ring(-like) structure `α` -/ protected def cast : ℤ → α | (n : ℕ) := n | -[1+ n] := -(n+1) @[priority 0] instance cast_coe : has_coe ℤ α := ⟨int.cast⟩
should be changed: the order of the variables should be changed.
Yes
That seems like an easy PR :grinning:
Could even do that from the Github editor (-;
Another thing we need to change is actually Lean 3. We could fork Lean 3 and remove the ability to backtrack in Lean 3 and see what breaks in mathlib. This would make the type class search much easier.
Who is keeping track of all the benefits of forking?
There was a thread about this somewhere, right?
This is an edit to mathlib we're talking about here
Oh I see, Johannes is suggesting changing the C++ code?
The edit to mathlib should happen. And it seems worthwhile to experiment with a different type class search in a forked Lean. I would not want to port mathlib to this forked Lean 3, at least not without more knowledge of the Lean 4 type class mechanism.
Results of a completely unscientific test; on this desktop, it took just under 15 minutes to compile mathlib HEAD, and then with the variable line in data/int/basic.lean
changed to
variables [has_neg α] [has_add α] [has_one α] [has_zero α]
(100% reversal) it took just under 14 minutes.
and example : has_coe ℤ ℕ := by apply_instance
now fails instantly! I have never seen that before!
We should make a Lean 4 todo list.
[class_instances] class-instance resolution trace [class_instances] (0) ?x_0 : has_one ℕ := @with_top.has_one ?x_1 ?x_2 ?x_3 failed is_def_eq [class_instances] (0) ?x_0 : has_one ℕ := @with_bot.has_one ?x_4 ?x_5 failed is_def_eq [class_instances] (0) ?x_0 : has_one ℕ := @with_zero.has_one ?x_6 ?x_7 failed is_def_eq [class_instances] (0) ?x_0 : has_one ℕ := @with_one.has_one ?x_8 failed is_def_eq [class_instances] (0) ?x_0 : has_one ℕ := @units.has_one ?x_9 ?x_10 failed is_def_eq [class_instances] (0) ?x_0 : has_one ℕ := unsigned.has_one failed is_def_eq [class_instances] (0) ?x_0 : has_one ℕ := @fin.has_one ?x_11 failed is_def_eq [class_instances] (0) ?x_0 : has_one ℕ := int.has_one failed is_def_eq [class_instances] (0) ?x_0 : has_one ℕ := nat.has_one
Which one should Lean have tried first, to find a one for nat? with_zero.has_one
or nat.has_one
?
[class_instances] class-instance resolution trace [class_instances] (0) ?x_0 : has_to_format tactic_state := int.has_to_format failed is_def_eq [class_instances] (0) ?x_0 : has_to_format tactic_state := @with_top.has_to_format ?x_1 ?x_2 failed is_def_eq [class_instances] (0) ?x_0 : has_to_format tactic_state := @with_bot.has_to_format ?x_3 ?x_4 failed is_def_eq [class_instances] (0) ?x_0 : has_to_format tactic_state := tactic.rcases_patt.has_to_format failed is_def_eq [class_instances] (0) ?x_0 : has_to_format tactic_state := tactic.rcases_patt_inverted.has_to_format failed is_def_eq [class_instances] (0) ?x_0 : has_to_format tactic_state := @array.has_to_format ?x_5 ?x_6 ?x_7 failed is_def_eq [class_instances] (0) ?x_0 : has_to_format tactic_state := subsingleton_info.has_to_format failed is_def_eq [class_instances] (0) ?x_0 : has_to_format tactic_state := fun_info.has_to_format failed is_def_eq [class_instances] (0) ?x_0 : has_to_format tactic_state := param_info.has_to_format failed is_def_eq [class_instances] (0) ?x_0 : has_to_format tactic_state := occurrences.has_to_format failed is_def_eq [class_instances] (0) ?x_0 : has_to_format tactic_state := tactic_state.has_to_format
rofl
with_top
very popular I see.
All from the output of
import data.int.basic set_option trace.class_instances true example : has_coe ℤ ℕ := by apply_instance
The instances added last get checked first. But this is usually not a problem, unification fails fast in these cases. The problem is if they match and the instance search runs in the wrong direction...
Aah I see.
I had the same issue here:
import algebra.module analysis.normed_space.basic data.real.basic class real_inner_product_space (V : Type*) [add_comm_group V] extends vector_space ℝ V := (inner : V → V → ℝ) (inner_axioms : false /- (axioms omitted here) -/) instance is_normed_space (V : Type*) [add_comm_group V] [real_inner_product_space V] : normed_space ℝ V := sorry set_option trace.class_instances true noncomputable example : add_comm_group ℝ := by apply_instance /- This easy instance cannot be found any more (infinte loop): [class_instances] class-instance resolution trace [class_instances] (0) ?x_0 : add_comm_group ℝ := @normed_group.to_add_comm_group ?x_1 ?x_2 [class_instances] (1) ?x_2 : normed_group ℝ := @normed_space.to_normed_group ?x_3 ?x_4 ?x_5 ?x_6 [class_instances] (2) ?x_6 : @normed_space ?x_3 ℝ ?x_5 := @is_normed_space ?x_7 ?x_8 ?x_9 [class_instances] (3) ?x_8 : add_comm_group ℝ := @normed_group.to_add_comm_group ?x_10 ?x_11 [class_instances] (4) ?x_11 : normed_group ℝ := @normed_space.to_normed_group ?x_12 ?x_13 ?x_14 ?x_15 ... -/
My current workaround is to put add_comm_group V
after extends
in real_inner_product_space
, i.e.
class real_inner_product_space (V : Type*) extends add_comm_group V, vector_space ℝ V :=
But of course this could lead to a messy hierarchy if I wanted to extend real_inner_product_space
further.
Another thing we need to change is actually Lean 3. We could fork Lean 3 and remove the ability to backtrack in Lean 3 and see what breaks in mathlib. This would make the type class search much easier.
For what it's worth, GHC has no backtracking in instance search (even with GHC extensions) and it seems to work pretty well for Haskell. Hard to say if it would also work well for a project like mathlib of course.
Results of a completely unscientific test; on this desktop, it took just under 15 minutes to compile mathlib HEAD, and then with the variable line in
data/int/basic.lean
changed tovariables [has_neg α] [has_add α] [has_one α] [has_zero α](100% reversal) it took just under 14 minutes.
Anyone who wants to merge #877?
{% endraw %}Last updated: Apr 24 2020 at 19:02 UTC


That's a Black Lab!
That's a Chocolate Lab!
That's a Siberian Husky!
That's a Golden Retriever!


  These slides are viewed best by Chrome and occasionally need to be refreshed if elements did not load properly. See here for PDF .

 .white[Press the **right arrow** to progress to the next slide!] --- background-image: url(images/bg1.jpg) background-size: cover class: hide-slide-number split-70 title-slide count: false .column.shade_black[.content[
 # .monash-blue.outline-text[ETC5510: Introduction to Data Analysis]
Week 8, part A

Text analysis
 .bottom_abs.width100[ Lecturer: *Nicholas Tierney & Stuart Lee* Department of Econometrics and Business Statistics

<EMAIL_ADDRESS>May 2020
 ] ]]

 <svg class="clip-svg absolute"> <defs> <clipPath id="swipe__clip-path" clipPathUnits="objectBoundingBox"> <polygon points="0.5745 0, 0.5 0.33, 0.42 0, 0 0, 0 1, 0.27 1, 0.27 0.59, 0.37 1, 0.634 1, 0.736 0.59, 0.736 1, 1 1, 1 0, 0.5745 0" /> </clipPath> </defs> </svg>

 --- class: refresher # recap - linear models (are awesome) - many models --- # Announcements - Assignment - Project - Peer review marking --- # Why text analysis? - Predict Melbourne house prices from realtor descriptions - Determine the extent of public discontent with train stoppages in Melbourne - The differences between Darwin's first edition of the Origin of the Species and the 6th edition - Does the sentiment of posts on Newcastle Jets public facebook page reflect their win/loss record? --- # Typical Process 1. Read in text 2. Pre-processing: remove punctuation signs, remove numbers, stop words, stem words 3. Tokenise: words, sentences, ngrams, chapters 4. Summarise 5. model --- # Packages In addition to `tidyverse` we will be using three other packages today ```r library(tidytext) library(gutenbergr) ``` --- # Tidytext - Using tidy data principles can make many text mining tasks easier, more effective, and consistent with tools already in wide use. - Learn more at https://www.tidytextmining.com/, by Julia Silge and David Robinson. --- # What is tidy text? ```r text <- c("This will be an uncertain time for us my love", "I can hear the echo of your voice in my head", "Singing my love", "I can see your face there in my hands my love", "I have been blessed by your grace and care my love", "Singing my love") text ## [1] "This will be an uncertain time for us my love" ## [2] "I can hear the echo of your voice in my head" ## [3] "Singing my love" ## [4] "I can see your face there in my hands my love" ## [5] "I have been blessed by your grace and care my love" ## [6] "Singing my love" ``` --- # What is tidy text? ```r text_df <- tibble(line = seq_along(text), text = text) text_df ## # A tibble: 6 x 2 ## line text ## <int> <chr> ## 1 1 This will be an uncertain time for us my love ## 2 2 I can hear the echo of your voice in my head ## 3 3 Singing my love ## 4 4 I can see your face there in my hands my love ## 5 5 I have been blessed by your grace and care my love ## 6 6 Singing my love ``` --- # What is tidy text? ```r text_df %>% unnest_tokens( output = word, input = text, token = "words" # default option ) ## # A tibble: 49 x 2 ## line word ## <int> <chr> ## 1 1 this ## 2 1 will ## 3 1 be ## 4 1 an ## 5 1 uncertain ## 6 1 time ## 7 1 for ## 8 1 us ## 9 1 my ## 10 1 love ## # … with 39 more rows ``` --- # What is unnesting? ```r text_df %>% unnest_tokens( output = word, input = text, token = "characters" ) ## # A tibble: 171 x 2 ## line word ## <int> <chr> ## 1 1 t ## 2 1 h ## 3 1 i ## 4 1 s ## 5 1 w ## 6 1 i ## 7 1 l ## 8 1 l ## 9 1 b ## 10 1 e ## # … with 161 more rows ``` --- # What is unnesting - ngrams length 2 ```r text_df %>% unnest_tokens( output = word, input = text, token = "ngrams", n = 2 ) ## # A tibble: 43 x 2 ## line word ## <int> <chr> ## 1 1 this will ## 2 1 will be ## 3 1 be an ## 4 1 an uncertain ## 5 1 uncertain time ## 6 1 time for ## 7 1 for us ## 8 1 us my ## 9 1 my love ## 10 2 i can ## # … with 33 more rows ``` --- # What is unnesting - ngrams length 3 ```r text_df %>% unnest_tokens( output = word, input = text, token = "ngrams", n = 3 ) ## # A tibble: 37 x 2 ## line word ## <int> <chr> ## 1 1 this will be ## 2 1 will be an ## 3 1 be an uncertain ## 4 1 an uncertain time ## 5 1 uncertain time for ## 6 1 time for us ## 7 1 for us my ## 8 1 us my love ## 9 2 i can hear ## 10 2 can hear the ## # … with 27 more rows ``` --- class: transition # Analyzing user reviews for Animal Crossing: New Horizons --- # About the data - User and critic reviews for the game [Animal Crossing](https://www.nintendo.com/games/detail/animal-crossing-new-horizons-switch/) scraped from Metacritc - This data comes from a [#TidyTuesday challenge](https://github.com/rfordatascience/tidytuesday/blob/master/data/2020/2020-05-05/readme.md). --- # What do the user reviews look like? ```r acnh_user_reviews <- read_tsv(here::here("slides/data/acnh_user_reviews.tsv")) glimpse(acnh_user_reviews) ## Rows: 2,999 ## Columns: 4 ## $ grade <dbl> 4, 5, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,… ## $ user_name <chr> "mds27272", "lolo2178", "Roachant", "Houndf", "ProfessorFox… ## $ text <chr> "My gf started playing before me. No option to create my ow… ## $ date <date> 2020-03-20, 2020-03-20, 2020-03-20, 2020-03-20, 2020-03-20… ``` --- # Let's look at the grade distrubtion  --- # Read a few of the positive reviews .left_code[ ```r set.seed(1999) acnh_user_reviews %>% filter(grade > 8) %>% sample_n(3) %>% pull(text) ``` ] .pull_right[ ``` ## [1] "The game is absolutely fantastic and everything we have been waiting for for seven long years. The ability to truly customize your island and all of the quality of life upgrade make this game so very worth the money. It’s a slow relaxing game that any fan of past Animal Crossing games would love." ## [2] "I've never played an Animal Crossing before and I can't stop playing it now! Amazing! there are lots of things to do! The characters are all charming, you can visit other islands, customize everything...It's a infinit game. People who are giving 0 problably never played the game.  ## [3] "This review contains spoilers, click expand to view. Ich liebe alles an diesem Spiel. Auch das neue Craften ist so eine gute idee gewesen. Die Musik ist auch wie in allen Vorgängern schön und beruhigend. Es fühlt sich einfach an ein perfektes Spiel… Expand" ``` ] --- # And some negative reviews .left_code[ ```r set.seed(2099) acnh_user_reviews %>% filter(grade == 0) %>% sample_n(3) %>% pull(text) ``` ] .pull_right[ ``` ## [1] "It's just a typical mobile grind-game with time-wall. And poor interface. Worst game of the year." ## [2] "One island per console, very family friendly. How unbelievably greedy by Nintendo." ## [3] "Separate islands for each profile should be a given. I'm not buying another switch just to have my own island. I'm also not going to play on my kid's island because it's not my island. This limitation should be in bold print and all caps on the cover of this game so people know what they're walking into. Nintendo will do nothing to address this and as a lifelong Nintendo player it's crazySeparate islands for each profile should be a given. I'm not buying another switch just to have my own island. I'm also not going to play on my kid's island because it's not my island. This limitation should be in bold print and all caps on the cover of this game so people know what they're walking into. Nintendo will do nothing to address this and as a lifelong Nintendo player it's crazy frustrating. Never looked at Metacritic in my life, but heard this is where to go to vent.… Expand" ``` ] --- # Looks like the scraping is messed up a bit Long reviews are compressed from the scraping procedure... ```r acnh_user_reviews_parsed <- acnh_user_reviews %>% mutate(text = str_remove(text, "Expand$")) ``` We will remove these characters from the text.. --- # Tidy up the reviews! ```r user_reviews_words <- acnh_user_reviews_parsed %>% unnest_tokens(output = word, input = text) user_reviews_words ## # A tibble: 362,729 x 4 ## grade user_name date word ## <dbl> <chr> <date> <chr> ## 1 4 mds27272 2020-03-20 my ## 2 4 mds27272 2020-03-20 gf ## 3 4 mds27272 2020-03-20 started ## 4 4 mds27272 2020-03-20 playing ## 5 4 mds27272 2020-03-20 before ## 6 4 mds27272 2020-03-20 me ## 7 4 mds27272 2020-03-20 no ## 8 4 mds27272 2020-03-20 option ## 9 4 mds27272 2020-03-20 to ## 10 4 mds27272 2020-03-20 create ## # … with 362,719 more rows ``` --- # Distribution of words per review? ```r user_reviews_words %>% count(user_name) %>% ggplot(aes(x = n)) + geom_histogram() ```  --- # What are the most common words? ```r user_reviews_words %>% count(word, sort = TRUE) ## # A tibble: 13,454 x 2 ## word n ## <chr> <int> ## 1 the 17739 ## 2 to 11857 ## 3 game 8769 ## 4 and 8740 ## 5 a 8330 ## 6 i 7211 ## 7 is 6858 ## 8 this 5777 ## 9 of 5383 ## 10 it 4711 ## # … with 13,444 more rows ``` --- # Stop words - In computing, stop words are words which are filtered out before or after processing of natural language data (text). - They usually refer to the most common words in a language, but there is not a single list of stop words used by all natural language processing tools. --- # English stop words ```r get_stopwords() ## # A tibble: 175 x 2 ## word lexicon ## <chr> <chr> ## 1 i snowball ## 2 me snowball ## 3 my snowball ## 4 myself snowball ## 5 we snowball ## 6 our snowball ## 7 ours snowball ## 8 ourselves snowball ## 9 you snowball ## 10 your snowball ## # … with 165 more rows ``` --- # Spanish stop words ```r get_stopwords(language = "es") ## # A tibble: 308 x 2 ## word lexicon ## <chr> <chr> ## 1 de snowball ## 2 la snowball ## 3 que snowball ## 4 el snowball ## 5 en snowball ## 6 y snowball ## 7 a snowball ## 8 los snowball ## 9 del snowball ## 10 se snowball ## # … with 298 more rows ``` --- # Various lexicons See `?get_stopwords` for more info. ```r get_stopwords(source = "smart") ## # A tibble: 571 x 2 ## word lexicon ## <chr> <chr> ## 1 a smart ## 2 a's smart ## 3 able smart ## 4 about smart ## 5 above smart ## 6 according smart ## 7 accordingly smart ## 8 across smart ## 9 actually smart ## 10 after smart ## # … with 561 more rows ``` --- # What are the most common words? ```r user_reviews_words %>% count(word, sort = TRUE) ## # A tibble: 13,454 x 2 ## word n ## <chr> <int> ## 1 the 17739 ## 2 to 11857 ## 3 game 8769 ## 4 and 8740 ## 5 a 8330 ## 6 i 7211 ## 7 is 6858 ## 8 this 5777 ## 9 of 5383 ## 10 it 4711 ## # … with 13,444 more rows ``` --- # What are the most common words? ```r stopwords_smart <- get_stopwords(source = "smart") user_reviews_words %>% anti_join(stopwords_smart) ## # A tibble: 145,444 x 4 ## grade user_name date word ## <dbl> <chr> <date> <chr> ## 1 4 mds27272 2020-03-20 gf ## 2 4 mds27272 2020-03-20 started ## 3 4 mds27272 2020-03-20 playing ## 4 4 mds27272 2020-03-20 option ## 5 4 mds27272 2020-03-20 create ## 6 4 mds27272 2020-03-20 island ## 7 4 mds27272 2020-03-20 guys ## 8 4 mds27272 2020-03-20 2nd ## 9 4 mds27272 2020-03-20 player ## 10 4 mds27272 2020-03-20 start ## # … with 145,434 more rows ``` --- ## Aside: the anti-join - A type of filtering join, will return all rows on the left when there are no matches on the right - Only keeps columns on the left --- ## As a picture  --- # What are the most common words? ```r user_reviews_words %>% anti_join(stopwords_smart) %>% count(word, sort = TRUE) ## # A tibble: 12,938 x 2 ## word n ## <chr> <int> ## 1 game 8769 ## 2 island 3974 ## 3 switch 2214 ## 4 play 2176 ## 5 player 1844 ## 6 nintendo 1694 ## 7 console 1489 ## 8 crossing 1371 ## 9 animal 1369 ## 10 people 1045 ## # … with 12,928 more rows ``` --- # What are the most common words? ```r user_reviews_words %>% anti_join(stopwords_smart) %>% count(word) %>% arrange(-n) %>% top_n(20) %>% ggplot(aes(fct_reorder(word, n), n)) + geom_col() + coord_flip() + theme_minimal() + labs(title = "Frequency of words in user reviews", subtitle = "", y = "", x = "") ``` ---  --- # Sentiment analysis - One way to analyze the sentiment of a text is to consider the text as a combination of its individual words - and the sentiment content of the whole text as the sum of the sentiment content of the individual words --- # Sentiment lexicons .pull-left[ ```r get_sentiments("afinn") ## # A tibble: 2,477 x 2 ## word value ## <chr> <dbl> ## 1 abandon -2 ## 2 abandoned -2 ## 3 abandons -2 ## 4 abducted -2 ## 5 abduction -2 ## 6 abductions -2 ## 7 abhor -3 ## 8 abhorred -3 ## 9 abhorrent -3 ## 10 abhors -3 ## # … with 2,467 more rows ``` ] .pull-right[ ```r get_sentiments("bing") ## # A tibble: 6,786 x 2 ## word sentiment ## <chr> <chr> ## 1 2-faces negative ## 2 abnormal negative ## 3 abolish negative ## 4 abominable negative ## 5 abominably negative ## 6 abominate negative ## 7 abomination negative ## 8 abort negative ## 9 aborted negative ## 10 aborts negative ## # … with 6,776 more rows ``` ] --- # Sentiment lexicons .pull-left[ ```r get_sentiments(lexicon = "bing") ## # A tibble: 6,786 x 2 ## word sentiment ## <chr> <chr> ## 1 2-faces negative ## 2 abnormal negative ## 3 abolish negative ## 4 abominable negative ## 5 abominably negative ## 6 abominate negative ## 7 abomination negative ## 8 abort negative ## 9 aborted negative ## 10 aborts negative ## # … with 6,776 more rows ``` ] .pull-right[ ```r get_sentiments(lexicon = "loughran") ## # A tibble: 4,150 x 2 ## word sentiment ## <chr> <chr> ## 1 abandon negative ## 2 abandoned negative ## 3 abandoning negative ## 4 abandonment negative ## 5 abandonments negative ## 6 abandons negative ## 7 abdicated negative ## 8 abdicates negative ## 9 abdicating negative ## 10 abdication negative ## # … with 4,140 more rows ``` ] --- # Sentiments in the reviews ```r sentiments_bing <- get_sentiments("bing") user_reviews_words %>% inner_join(sentiments_bing) %>% count(sentiment, word, sort = TRUE) ## # A tibble: 1,622 x 3 ## sentiment word n ## <chr> <chr> <int> ## 1 positive like 1357 ## 2 positive fun 760 ## 3 positive great 661 ## 4 positive progress 556 ## 5 positive good 486 ## 6 positive enjoy 405 ## 7 positive love 403 ## 8 positive best 368 ## 9 negative bad 316 ## 10 positive amazing 304 ## # … with 1,612 more rows ``` --- # Visualising sentiments  --- # Visualising sentiments ```r user_reviews_words %>% inner_join(sentiments_bing) %>% count(sentiment, word, sort = TRUE) %>% arrange(desc(n)) %>% group_by(sentiment) %>% top_n(10) %>% ungroup() %>% ggplot(aes(fct_reorder(word, n), n, fill = sentiment)) + geom_col() + coord_flip() + facet_wrap(~sentiment, scales = "free") + theme_minimal() + labs( title = "Sentiments in user reviews", x = "" ) ``` --- # Common words over grades ```r user_reviews_words %>% anti_join(stopwords_smart) %>% count(grade, word, sort = TRUE) ## # A tibble: 29,010 x 3 ## grade word n ## <dbl> <chr> <int> ## 1 0 game 2989 ## 2 0 island 1783 ## 3 10 game 1685 ## 4 0 switch 1058 ## 5 0 play 1027 ## 6 0 player 921 ## 7 0 nintendo 902 ## 8 1 game 898 ## 9 9 game 802 ## 10 0 console 738 ## # … with 29,000 more rows ``` --- # Common review words by grade - With stop words: ```r user_reviews_words %>% count(grade, word, sort = TRUE) ## # A tibble: 33,237 x 3 ## grade word n ## <dbl> <chr> <int> ## 1 0 the 5865 ## 2 0 to 4421 ## 3 0 game 2989 ## 4 10 the 2896 ## 5 0 and 2767 ## 6 0 a 2663 ## 7 0 i 2656 ## 8 0 is 2304 ## 9 0 this 2171 ## 10 9 the 1913 ## # … with 33,227 more rows ``` --- # What is a document about? ## How do we measure the importance of a word to a document in a collection of documents? i.e a novel in a collection of novels or a review in a set of reviews... We combine the following statistics: - Term frequency - Inverse document frequency --- # Term frequency The raw frequency of a word `\(w\)` in a document `\(d\)`. It is a function of the word and the document. $$tf(w, d) = \frac{\text{count of w in d}}{\text{total count in d}} $$ --- # Term frequency For our reviews a document is a single user's review. ```r document <- user_reviews_words %>% anti_join(stopwords_smart) %>% filter(user_name == "Discoduckasaur") document ## # A tibble: 372 x 4 ## grade user_name date word ## <dbl> <chr> <date> <chr> ## 1 4 Discoduckasaur 2020-04-23 start ## 2 4 Discoduckasaur 2020-04-23 game ## 3 4 Discoduckasaur 2020-04-23 incredibly ## 4 4 Discoduckasaur 2020-04-23 fun ## 5 4 Discoduckasaur 2020-04-23 base ## 6 4 Discoduckasaur 2020-04-23 asinine ## 7 4 Discoduckasaur 2020-04-23 decisions ## 8 4 Discoduckasaur 2020-04-23 made ## 9 4 Discoduckasaur 2020-04-23 nintendo ## 10 4 Discoduckasaur 2020-04-23 simply ## # … with 362 more rows ``` --- # Term frequency The term frequency for each word is the number of times that word occurs divided by the total number of words in the document. ```r tbl_tf <- document %>% count(word, sort = TRUE) %>% mutate(tf = n / sum(n)) tbl_tf %>% arrange(desc(tf)) ## # A tibble: 246 x 3 ## word n tf ## <chr> <int> <dbl> ## 1 game 15 0.0403 ## 2 time 14 0.0376 ## 3 it’s 7 0.0188 ## 4 nintendo 6 0.0161 ## 5 i’m 5 0.0134 ## 6 bad 4 0.0108 ## 7 fun 4 0.0108 ## 8 give 4 0.0108 ## 9 incredibly 4 0.0108 ## 10 means 4 0.0108 ## # … with 236 more rows ``` --- ## Inverse-document frequency The inverse document frequency tells how common or rare a word is accross a collection of documents. It is a function of a word `\(w\)`, and the collection of documents `\(\mathcal{D}\)`. `$$idf(w, \mathcal{D}) = \log{\left(\frac{\text{size of } \mathcal{D}}{\text{number of documents that contain } w}\right)}$$` --- ## Inverse document frequency For the reviews data set, our collection is all the reviews. You could compute this in a somewhat roundabout as follows: ```r tbl_idf <- user_reviews_words %>% anti_join(stopwords_smart) %>% mutate(collection_size = n_distinct(user_name)) %>% group_by(collection_size, word) %>% summarise(times_word_used = n_distinct(user_name)) %>% mutate(freq = collection_size / times_word_used, idf = log(freq)) arrange(tbl_idf, idf) ## # A tibble: 12,938 x 5 ## # Groups: collection_size [1] ## collection_size word times_word_used freq idf ## <int> <chr> <int> <dbl> <dbl> ## 1 2999 game 2354 1.27 0.242 ## 2 2999 island 1671 1.79 0.585 ## 3 2999 switch 1123 2.67 0.982 ## 4 2999 play 1049 2.86 1.05 ## 5 2999 nintendo 984 3.05 1.11 ## 6 2999 console 788 3.81 1.34 ## 7 2999 player 745 4.03 1.39 ## 8 2999 animal 734 4.09 1.41 ## 9 2999 crossing 721 4.16 1.43 ## 10 2999 people 576 5.21 1.65 ## # … with 12,928 more rows ``` --- ## Putting it together term frequency, inverse document frequency Multiply tf and idf together. This is a function of a word `\(w\)`, a document `\(d\)`, and the collection of documents `\(\mathcal{D}\)`: $$ tf\_idf(w, d, \mathcal{D}) = tf(w,d) \times idf(w, \mathcal{D})$$ High value of `\(tf\_idf\)` that a word has a high frequency within a document but is quite rare over all documents. Likewise if a word occurs in a lot of documents idf will be close to zero, so `\(tf\_idf\)` will be small. --- ## Putting it together, tf-idf We illustrate the example for a single user review: ```r tbl_tf %>% left_join(tbl_idf) %>% select(word, tf, idf) %>% mutate(tf_idf = tf * idf) %>% arrange(desc(tf_idf)) ## # A tibble: 246 x 4 ## word tf idf tf_idf ## <chr> <dbl> <dbl> <dbl> ## 1 turnips 0.0108 6.62 0.0712 ## 2 time 0.0376 1.78 0.0669 ## 3 zone 0.00806 7.31 0.0590 ## 4 it’s 0.0188 2.81 0.0528 ## 5 i’m 0.0134 3.64 0.0489 ## 6 you’ll 0.00806 5.70 0.0460 ## 7 incredibly 0.0108 4.05 0.0436 ## 8 hurting 0.00538 8.01 0.0430 ## 9 means 0.0108 3.62 0.0390 ## 10 accepted 0.00538 6.91 0.0371 ## # … with 236 more rows ``` --- # Calculating tf-idf: Perhaps not that exciting... Instead of rolling our own, we can use `tidytext` ```r user_reviews_counts <- user_reviews_words %>% anti_join(stopwords_smart) %>% count(user_name, word, sort = TRUE) %>% bind_tf_idf(term = word, document = user_name, n = n) user_reviews_counts ## # A tibble: 93,540 x 6 ## user_name word n tf idf tf_idf ## <chr> <chr> <int> <dbl> <dbl> <dbl> ## 1 Melondrea island 49 0.5 0.585 0.292 ## 2 Melondrea console 48 0.490 1.34 0.655 ## 3 ScissorSheep game 29 0.254 0.242 0.0616 ## 4 ScissorSheep bombing 28 0.246 3.62 0.890 ## 5 ScissorSheep review 28 0.246 2.19 0.538 ## 6 ScissorSheep stop 28 0.246 3.36 0.826 ## 7 Interruptor eggs 27 0.203 5.70 1.16 ## 8 Ditobi de 26 0.0568 3.44 0.195 ## 9 Lucishungry game 26 0.0912 0.242 0.0221 ## 10 Teacol game 21 0.084 0.242 0.0203 ## # … with 93,530 more rows ``` --- # What words were important to (a sample of) users that had positive reviews?  --- # Your Turn: - Go to Rstudio and extend the analyses done in the lecture - This time we will look at critics reviews --- # Lab exercise (bonus!) Text Mining with R has an example comparing historical physics textbooks: *Discourse on Floating Bodies* by Galileo Galilei, *Treatise on Light* by Christiaan Huygens, *Experiments with Alternate Currents of High Potential and High Frequency* by Nikola Tesla, and *Relativity: The Special and General Theory* by Albert Einstein. All are available on the Gutenberg project. Work your way through the [comparison of physics books](https://www.tidytextmining.com/tfidf.html#a-corpus-of-physics-texts). It is section 3.4. --- # Thanks - Dr. Mine Çetinkaya-Rundel - Dr. Julia Silge: https://github.com/juliasilge/tidytext-tutorial and https://juliasilge.com/blog/animal-crossing/ - Dr. Julia Silge and Dr. David Robinson: https://www.tidytextmining.com/ --- background-image: url(images/bg1.jpg) background-size: cover class: hide-slide-number split-70 count: false .column.shade_black[.content[

 # That's it! .bottom_abs.width100[ Lecturer: Nicholas Tierney & Stuart Lee Department of Econometrics and Business Statistics

<EMAIL_ADDRESS>May 2020 ]
 This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.  ]]

 <svg class="clip-svg absolute"> <defs> <clipPath id="swipe__clip-path" clipPathUnits="objectBoundingBox"> <polygon points="0.5745 0, 0.5 0.33, 0.42 0, 0 0, 0 1, 0.27 1, 0.27 0.59, 0.37 1, 0.634 1, 0.736 0.59, 0.736 1, 1 1, 1 0, 0.5745 0" /> </clipPath> </defs> </svg>


|
GenericMatrix
A generic template matrix class.
|
The GenericMatrix class defines a generic template matrix class, the matrix elements are managed by a one-dimension pointer. More...
#include <GenericMatrix.h>
Public Types | |
| using | size_type = std::size_t |
| using | value_type = Elem |
| using | iterator = value_type * |
| using | const_iterator = const iterator |
Public Member Functions | |
| GenericMatrix () | |
| GenericMatrix (size_type row, size_type col) | |
| GenericMatrix (size_type row, size_type col, const Elem &initialValue) | |
| GenericMatrix (size_type row, size_type col, Elem *data) | |
| GenericMatrix (const GenericMatrix &other) | |
| GenericMatrix (GenericMatrix &&other) noexcept | |
| ~GenericMatrix () | |
| GenericMatrix & | operator= (const GenericMatrix &other) |
| GenericMatrix & | operator= (GenericMatrix &&other) noexcept |
| iterator | begin () noexcept |
| const_iterator | begin () const noexcept |
| const_iterator | cbegin () const noexcept |
| iterator | end () noexcept |
| const_iterator | end () const noexcept |
| const_iterator | cend () const noexcept |
| size_type | rows () const |
| size_type | columns () const |
| size_type | size () const |
| Elem * | data () noexcept |
| const Elem * | data () const noexcept |
| const Elem * | constData () const noexcept |
| Elem * | data (size_type row, size_type col) noexcept |
| const Elem * | data (size_type row, size_type col) const noexcept |
| const Elem * | constData (size_type row, size_type col) const noexcept |
| Elem * | dataAt (size_type row, size_type col) noexcept |
| const Elem * | dataAt (size_type row, size_type col) const noexcept |
| const Elem * | constDataAt (size_type row, size_type col) const noexcept |
| Elem & | operator() (size_type row, size_type col) |
| const Elem & | operator() (size_type row, size_type col) const |
| Elem & | at (size_type row, size_type col) |
| const Elem & | at (size_type row, size_type col) const |
| bool | empty () const |
| bool | isValid () const |
| bool | isIdentity () const |
| bool | isHomomorphicTo (const GenericMatrix< Elem > &m) |
| void | resize (size_type row, size_type col) |
| void | resize (size_type row, size_type col, const Elem &initialValue) |
| void | reset (size_type row, size_type col, Elem *data) |
| void | setToIdentity () |
| void | fill (const Elem &value) |
| void | swap (GenericMatrix< Elem > &other) |
| GenericMatrix< Elem > | reverse () const |
| GenericMatrix< Elem > | transposed () const |
| void | doHadamardProduct (const GenericMatrix< Elem > &m) |
| GenericMatrix< Elem > | roi (size_type row1, size_type col1, size_type row2, size_type col2) |
| GenericMatrix< Elem > & | operator+= (const GenericMatrix< Elem > &m) |
| GenericMatrix< Elem > & | operator-= (const GenericMatrix< Elem > &m) |
| GenericMatrix< Elem > & | operator *= (const GenericMatrix< Elem > &m) |
| GenericMatrix< Elem > & | operator *= (const Elem &factor) |
| GenericMatrix< Elem > & | operator/= (const Elem &divisor) |
| bool | operator== (const GenericMatrix< Elem > &m) const |
| bool | operator!= (const GenericMatrix< Elem > &m) const |
Static Public Member Functions | |
| static bool | isHomomorphic (const GenericMatrix< Elem > &m1, const GenericMatrix< Elem > &m2) |
| static GenericMatrix< Elem > | hadamardProduct (const GenericMatrix< Elem > &m1, const GenericMatrix< Elem > &m2) |
Friends | |
| template<typename __ElemDTo , typename __Elem > | |
| GenericMatrix< __ElemDTo > | matrix_cast (const GenericMatrix< __Elem > &m) |
| template<typename __Elem > | |
| GenericMatrix< __Elem > | operator+ (const GenericMatrix< __Elem > &m1, const GenericMatrix< __Elem > &m2) |
| template<typename __Elem > | |
| GenericMatrix< __Elem > | operator- (const GenericMatrix< __Elem > &m1, const GenericMatrix< __Elem > &m2) |
| template<typename __Elem > | |
| GenericMatrix< __Elem > | operator * (const GenericMatrix< __Elem > &m1, const GenericMatrix< __Elem > &m2) |
| template<typename __Elem > | |
| GenericMatrix< __Elem > | operator * (const GenericMatrix< __Elem > &matrix, const __Elem &factor) |
| template<typename __Elem > | |
| GenericMatrix< __Elem > | operator * (const __Elem &factor, const GenericMatrix< __Elem > &matrix) |
| template<typename __Elem > | |
| GenericMatrix< __Elem > | operator/ (const GenericMatrix< __Elem > &matrix, const __Elem &divisor) |
| template<typename __Elem > | |
| GenericMatrix< __Elem > | operator- (const GenericMatrix< __Elem > &matrix) |
| template<typename __Elem > | |
| std::ostream & | operator<< (std::ostream &os, const GenericMatrix< __Elem > &matrix) |
The GenericMatrix class defines a generic template matrix class, the matrix elements are managed by a one-dimension pointer.
The GenericMatrix template has one parameter:
Definition at line 38 of file GenericMatrix.h.
| GenericMatrix< Elem >::const_iterator |
An STL-style const iterator for GenericMatrix.
Definition at line 44 of file GenericMatrix.h.
| GenericMatrix< Elem >::iterator |
An STL-style non-const iterator for GenericMatrix.
Definition at line 43 of file GenericMatrix.h.
| GenericMatrix< Elem >::size_type |
Type for declaring the matrix's rows and columns.
Definition at line 41 of file GenericMatrix.h.
| GenericMatrix< Elem >::value_type |
The value type of the template parameter Elem.
Definition at line 42 of file GenericMatrix.h.
| GenericMatrix< Elem >::GenericMatrix | ( | ) |
| GenericMatrix< Elem >::GenericMatrix | ( | size_type | row, |
| size_type | col | ||
| ) |
Constructs a row x col matrix without initializing the contents.
Definition at line 179 of file GenericMatrix.h.
| GenericMatrix< Elem >::GenericMatrix | ( | size_type | row, |
| size_type | col, | ||
| const Elem & | initialValue | ||
| ) |
Constructs a row x col matrix and initialize all values with initialValue.
Definition at line 204 of file GenericMatrix.h.
| GenericMatrix< Elem >::GenericMatrix | ( | size_type | row, |
| size_type | col, | ||
| Elem * | data | ||
| ) |
Constructs a row x col matrix and set the element pointer to data.
Definition at line 193 of file GenericMatrix.h.
| GenericMatrix< Elem >::GenericMatrix | ( | const GenericMatrix< Elem > & | other | ) |
Constructs a copy of other.
Definition at line 274 of file GenericMatrix.h.
|
noexcept |
Move-constructs a GenericMatrix instance, making it point at the same object that other was pointing to.
Definition at line 285 of file GenericMatrix.h.
| GenericMatrix< Elem >::~GenericMatrix | ( | ) |
Destroys the matrix.
Definition at line 215 of file GenericMatrix.h.
| Elem & GenericMatrix< Elem >::at | ( | size_type | row, |
| size_type | col | ||
| ) |
Returns a reference to the element at position (row, column) in this matrix, with bounds checking.
| std::out_of_range | if position (row, col) is not within the range of the matrix. |
Definition at line 567 of file GenericMatrix.h.
| const Elem & GenericMatrix< Elem >::at | ( | size_type | row, |
| size_type | col | ||
| ) | const |
Returns a constant reference to the element at position (row, column) in this matrix, with bounds checking.
| std::out_of_range | if position (row, col) is not within the range of the matrix. |
Definition at line 551 of file GenericMatrix.h.
|
noexcept |
Definition at line 331 of file GenericMatrix.h.
|
noexcept |
Definition at line 337 of file GenericMatrix.h.
|
noexcept |
Definition at line 343 of file GenericMatrix.h.
|
noexcept |
Definition at line 361 of file GenericMatrix.h.
| GenericMatrix< Elem >::size_type GenericMatrix< Elem >::columns | ( | ) | const |
Returns the number of matrix columns.
Definition at line 383 of file GenericMatrix.h.
|
noexcept |
Returns a constant pointer to the raw data of this matrix.
Definition at line 427 of file GenericMatrix.h.
|
noexcept |
Returns a constant offset row and col pointer to the raw data of this matrix.
Definition at line 466 of file GenericMatrix.h.
|
noexcept |
Returns a constant offset row and col pointer to the raw data of this matrix. If row or col out of range, returns end();
Definition at line 508 of file GenericMatrix.h.
|
noexcept |
Returns a pointer to the raw data of this matrix.
Definition at line 405 of file GenericMatrix.h.
|
noexcept |
Returns a constant pointer to the raw data of this matrix.
Definition at line 416 of file GenericMatrix.h.
|
noexcept |
Returns a offset row and col pointer to the raw data of this matrix.
Definition at line 440 of file GenericMatrix.h.
|
noexcept |
Returns a constant offset row and col pointer to the raw data of this matrix.
Definition at line 453 of file GenericMatrix.h.
|
noexcept |
Returns a offset row and col pointer to the raw data of this matrix.
If row or col out of range, returns end();
Definition at line 479 of file GenericMatrix.h.
|
noexcept |
Returns a constant offset row and col pointer to the raw data of this matrix.
If row or col out of range, returns end();
Definition at line 494 of file GenericMatrix.h.
| void GenericMatrix< Elem >::doHadamardProduct | ( | const GenericMatrix< Elem > & | m | ) |
Do the hadamard product of this matrix and the matrix m.
| std::invalid_argument | if m1 and m2 are not homomorphic. |
Definition at line 723 of file GenericMatrix.h.
| bool GenericMatrix< Elem >::empty | ( | ) | const |
Returns true
if this matrix element's size equal to 0, otherwise returns false
.
Definition at line 579 of file GenericMatrix.h.
|
noexcept |
Definition at line 349 of file GenericMatrix.h.
|
noexcept |
Definition at line 355 of file GenericMatrix.h.
| void GenericMatrix< Elem >::fill | ( | const Elem & | value | ) |
Fills all elements of this matrix with value.
Definition at line 711 of file GenericMatrix.h.
|
static |
Returns the hadamard product of the matrix m1 and the matrix m2.
| std::invalid_argument | if m1 and m2 are not homomorphic. |
Definition at line 743 of file GenericMatrix.h.
|
inlinestatic |
Returns true
if matrix m1 and matrix m2 are homomorphic; false otherwise.
Definition at line 794 of file GenericMatrix.h.
|
inline |
Returns true
if this matrix and matrix m are homomorphic; false otherwise.
Definition at line 783 of file GenericMatrix.h.
| bool GenericMatrix< Elem >::isIdentity | ( | ) | const |
Returns true
if this matrix is the identity; false otherwise.
Definition at line 600 of file GenericMatrix.h.
| bool GenericMatrix< Elem >::isValid | ( | ) | const |
Returns true
if this matrix internal data is not null pointer and matrix rows/cols greater than 0, otherwise returns false
.
Definition at line 589 of file GenericMatrix.h.
| GenericMatrix< Elem > & GenericMatrix< Elem >::operator *= | ( | const GenericMatrix< Elem > & | m | ) |
Multiplies this matrix and matrix m, in format: this = this * m.
| std::invalid_argument | if this matrix's columns is not equal to matrix m's rows. |
Definition at line 852 of file GenericMatrix.h.
| GenericMatrix< Elem > & GenericMatrix< Elem >::operator *= | ( | const Elem & | factor | ) |
Multiplies all elements of this matrix by factor.
Definition at line 874 of file GenericMatrix.h.
| bool GenericMatrix< Elem >::operator!= | ( | const GenericMatrix< Elem > & | m | ) | const |
Returns true
if this matrix is not identical to m; false otherwise.
Definition at line 917 of file GenericMatrix.h.
| Elem & GenericMatrix< Elem >::operator() | ( | size_type | row, |
| size_type | column | ||
| ) |
Returns a reference to the element at position (row, column) in this matrix so that the element can be assigned to.
Definition at line 537 of file GenericMatrix.h.
| const Elem & GenericMatrix< Elem >::operator() | ( | size_type | row, |
| size_type | column | ||
| ) | const |
Returns a constant reference to the element at position (row, column) in this matrix.
Definition at line 523 of file GenericMatrix.h.
| GenericMatrix< Elem > & GenericMatrix< Elem >::operator+= | ( | const GenericMatrix< Elem > & | m | ) |
Adds the contents of m to this matrix.
| std::invalid_argument | if this matrix and matrix m are not homomorphic. |
Definition at line 816 of file GenericMatrix.h.
| GenericMatrix< Elem > & GenericMatrix< Elem >::operator-= | ( | const GenericMatrix< Elem > & | m | ) |
Subtracts the contents of m from this matrix.
| std::invalid_argument | if this matrix and matrix m are not homomorphic. |
Definition at line 835 of file GenericMatrix.h.
| GenericMatrix< Elem > & GenericMatrix< Elem >::operator/= | ( | const Elem & | divisor | ) |
Divides all elements of this matrix by divisor.
Definition at line 888 of file GenericMatrix.h.
| GenericMatrix< Elem > & GenericMatrix< Elem >::operator= | ( | const GenericMatrix< Elem > & | other | ) |
Assigns other to this matrix and returns a reference to this matrix.
Definition at line 297 of file GenericMatrix.h.
|
noexcept |
Move-assigns other to this GenericMatrix instance.
Definition at line 313 of file GenericMatrix.h.
| bool GenericMatrix< Elem >::operator== | ( | const GenericMatrix< Elem > & | m | ) | const |
Returns true
if this matrix is identical to m; false otherwise.
Definition at line 902 of file GenericMatrix.h.
| void GenericMatrix< Elem >::reset | ( | size_type | row, |
| size_type | col, | ||
| Elem * | data | ||
| ) |
Reset this matrix to row x col matrix and set the elments pointer to data.
Definition at line 649 of file GenericMatrix.h.
| void GenericMatrix< Elem >::resize | ( | size_type | row, |
| size_type | col | ||
| ) |
Reconstructs a row x col identity matrix without initializing the contents.
Definition at line 620 of file GenericMatrix.h.
| void GenericMatrix< Elem >::resize | ( | size_type | row, |
| size_type | col, | ||
| const Elem & | initialValue | ||
| ) |
Reconstructs a row x col identity matrix and initialize all values with initialValue.
Definition at line 637 of file GenericMatrix.h.
| GenericMatrix< Elem > GenericMatrix< Elem >::reverse | ( | ) | const |
Returns a new matrix reversed by this matrix.
Definition at line 680 of file GenericMatrix.h.
| GenericMatrix< Elem > GenericMatrix< Elem >::roi | ( | size_type | row1, |
| size_type | col1, | ||
| size_type | row2, | ||
| size_type | col2 | ||
| ) |
Extracts region of interest of this matrix.
Definition at line 763 of file GenericMatrix.h.
| GenericMatrix< Elem >::size_type GenericMatrix< Elem >::rows | ( | ) | const |
Returns the number of matrix rows.
Definition at line 372 of file GenericMatrix.h.
| void GenericMatrix< Elem >::setToIdentity | ( | ) |
Sets this matrix to the identity.
Definition at line 663 of file GenericMatrix.h.
| GenericMatrix< Elem >::size_type GenericMatrix< Elem >::size | ( | ) | const |
Returns the number of matrix elements.
Definition at line 394 of file GenericMatrix.h.
| void GenericMatrix< Elem >::swap | ( | GenericMatrix< Elem > & | other | ) |
Swaps matrix other with this matrix.
Definition at line 803 of file GenericMatrix.h.
| GenericMatrix< Elem > GenericMatrix< Elem >::transposed | ( | ) | const |
Returns this matrix, transposed about its diagonal.
Definition at line 696 of file GenericMatrix.h.
|
friend |
Converts a matrix to a different type matrix.
static_cast<__ElemDst>(__Elem)
. Definition at line 938 of file GenericMatrix.h.
|
friend |
Returns the product of the M1xNN
matrix m1 and the NNxM2
matrix m2 to produce a M1xM2
matrix result.
| std::invalid_argument | if m1's columns is not equal to matrix m2's rows. |
Definition at line 1001 of file GenericMatrix.h.
|
friend |
Returns the result of multiplying all elements of matrix by factor.
Definition at line 1024 of file GenericMatrix.h.
|
friend |
Returns the result of multiplying all elements of matrix by factor.
Definition at line 1040 of file GenericMatrix.h.
|
friend |
Returns the sum of m1 and m2.
| std::invalid_argument | if this matrix and matrix m are not homomorphic. |
Definition at line 958 of file GenericMatrix.h.
|
friend |
Returns the difference of m1 and m2.
| std::invalid_argument | if this matrix and matrix m are not homomorphic. |
Definition at line 979 of file GenericMatrix.h.
|
friend |
Returns the negation of matrix.
Definition at line 1072 of file GenericMatrix.h.
|
friend |
Returns the result of dividing all elements of matrix by divisor.
Definition at line 1056 of file GenericMatrix.h.
|
friend |
Writes the given matrix to the given stream and returns a reference to the stream.
Definition at line 1089 of file GenericMatrix.h.


This is the SystemVerilog side of the OFC framework. Use it to either create a co-emulation environment or to connect the SV testbench to a Python evironment. To integrate the OFC framework into your verification environment you need to: 1) Replace your usual UVM drivers with the OFC driver using UVM factory override 2) Configure the OFC driver using its configuration object 3) Configure the OFC server connector using its configuration object 2) Create your own OFC monitor 3) Integrate the Python side of the OFC framework


| Path: | README.rdoc |
| Last Update: | Mon Nov 02 09:12:33 -0500 2009 |
Validatable is a library for adding validations.
Created by Jay Fields, updated by John Nunemaker
$ gem install jnunemaker-validatable -s http://gemcutter.org
You may use, copy and redistribute this library under the same terms as Ruby itself (see www.ruby-lang.org/en/LICENSE.txt).
Validation of an entire hierarchy of objects with errors aggregated at the root object.
class Person include Validatable validates_presence_of :name attr_accessor :name end class PersonPresenter include Validatable include_validations_for :person attr_accessor :person def initialize(person) @person = person end end presenter = PersonPresenter.new(Person.new) presenter.valid? #=> false presenter.errors.on(:name) #=> "can't be blank"
Validations that turn off after X times of failed attempts.
class Person include Validatable validates_presence_of :name, :times => 1 attr_accessor :name end person = Person.new person.valid? #=> false person.valid? #=> true
Validations can be given levels. If a validation fails on a level the validations for subsequent levels will not be executed.
class Person include Validatable validates_presence_of :name, :level => 1, :message => "name message" validates_presence_of :address, :level => 2 attr_accessor :name, :address end person = Person.new person.valid? #=> false person.errors.on(:name) #=> "name message" person.errors.on(:address) #=> nil
Validations can also be given groups. Groups can be used to validate an object when it can be valid in various states. For example a mortgage application may be valid for saving (saving a partial application), but that same mortgage application would not be valid for underwriting. In our example a application can be saved as long as a Social Security Number is present; however, an application can not be underwritten unless the name attribute contains a value.
class MortgageApplication include Validatable validates_presence_of :ssn, :groups => [:saving, :underwriting] validates_presence_of :name, :groups => :underwriting attr_accessor :name, :ssn end application = MortgageApplication.new application.ssn = 377990118 application.valid_for_saving? #=> true application.valid_for_underwriting? #=> false
As you can see, you can use an array if the validation needs to be part of various groups. However, if the validation only applies to one group you can simply use a symbol for the group name.
Similar to Rails, Validatable also supports conditional validation.
class Person include Validatable attr_accessor :name validates_format_of :name, :with => /.+/, :if => Proc.new { !name.nil? } end Person.new.valid? #=> true
Validatable also exposes an after_validate hook method.
class Person include Validatable validates_presence_of :name attr_accessor :name end class ValidatesPresenceOf after_validate do |result, instance, attribute| instance.errors.add("#{attribute} can't be blank") unless result end end person = Person.new person.valid? #=> false person.errors.on(:name) #=> "name can't be blank"
The after_validate hook yields the result of the validation being run, the instance the validation was run on, and the attribute that was validated
In the above example the attribute "name" is appended to the message.
See the tests for more examples
Rick Bradley, Anonymous Z, Jason Miller, Ali Aghareza, Xavier Shay, Dan Manges, Karthik Krishnan and Venkat, Clint Bishop, Chris Didyk, Yi Wen


Alert Filters allow you to automatically override the risk levels of any alerts raised by the active and passive scan.
There are 2 different types of Alert Filter:
Alert Filters can also be defined in the Automation Framework.
The easiest way to create Alert Filters is to right click an alert and select
the 'Create Alert Filter...' option. This will display the
Alert Filter Dialog.
You can also create Alert Filter manually.


Subclass this type to implement customized logging event filtering
For a list of all members of this type, see FilterSkeleton Members.
System.Object
log4net.Filter.FilterSkeleton
log4net.Filter.DenyAllFilter
log4net.Filter.LevelMatchFilter
log4net.Filter.LevelRangeFilter
log4net.Filter.LoggerMatchFilter
log4net.Filter.StringMatchFilter
This type is not safe for multithreaded operations.
Users should extend this class to implement customized logging event filtering. Note that Logger and AppenderSkeleton, the parent class of all standard appenders, have built-in filtering rules. It is suggested that you first use and understand the built-in rules before rushing to write your own custom filters.
This abstract class assumes and also imposes that filters be organized in a linear chain. The Decide method of each filter is called sequentially, in the order of their addition to the chain.
The Decide method must return one of the integer constants Deny, Neutral or Accept.
If the value Deny is returned, then the log event is dropped immediately without consulting with the remaining filters.
If the value Neutral is returned, then the next filter in the chain is consulted. If there are no more filters in the chain, then the log event is logged. Thus, in the presence of no filters, the default behavior is to log all logging events.
If the value Accept is returned, then the log event is logged without consulting the remaining filters.
The philosophy of log4net filters is largely inspired from the Linux ipchains.
Namespace: log4net.Filter
Assembly: log4net (in log4net.dll)
FilterSkeleton Members | log4net.Filter Namespace


Teaching assistant Classroom assistant, learning support assistant
Teaching assistants support teachers and help children develop.
1. How to become a teaching assistant
Each school sets its own entry requirements. Check job vacancies on your local education authority’s website to find out what each school wants.
You'll usually need:
- experience of working with children
- GCSEs at grades 9 to 4 (A* to C) or equivalent, in English and maths
Experience or qualifications in nursery work, childcare, playwork or youth work could also be helpful.
If you don’t have any experience you could get taken on if you can show you have the personality and potential to perform well in the role.
Many teaching assistants volunteer first before getting paid work.
There is strong competition for jobs so a qualification can give you an advantage.
You could study for qualifications like:
- Level 2 Award in Support Work in Schools
- Level 2 Certificate in Supporting Teaching and Learning in Schools
- Level 3 Award/Certificate in Supporting Teaching and Learning in Schools
- Level 3 Diploma in Specialist Support for Teaching and Learning in Schools
- Foundation Degree in Teaching and Learning Support
If you’re under 19, these courses are free.
Search for a course in supporting teaching and learning.
You can get help with the cost of a course.
You could also get training on the job, or get in through an apprenticeship in supporting teaching and learning in schools.
You'll need to pass enhanced background checks.
You can find out more at Teaching Assistant Focus.
2. Skills
You'll need:
- the ability to build good relationships with children, teachers and parents
- organisational, planning and IT skills
- the ability to manage children and cope with challenging behaviour
- creativity to design materials and activities
3. What you'll do
Most jobs are in nursery, primary and special schools. You could also work in secondary or independent schools and academies.
Your day-to-day duties could include:
- getting the classroom ready for lessons and clearing away afterwards
- listening to children read or reading to them
- helping children who need extra support
- helping teachers prepare materials that match development needs
- supervising group activities, including outings and sports events
- helping teachers manage class behaviour
- looking after children who are upset or unwell
- leading classes with help from the teacher
4. Salary
Starter: £11,500 to £14,000
Experienced: £15,000 to £17,000
Highly Experienced: £17,000 to £23,000 (higher level teaching assistant)
Wages are set by local education authorities or by the school.
You may only get paid for the weeks you work during term time.
These figures are a guide.
5. Working hours, patterns and environment
You'll work from around 8.30am to 3.15pm or 4.15pm.
You may also attend meetings and training outside these hours.
6. Career path and progression
With experience, you could become a senior assistant or apply for a Higher Level Teaching Assistant (HLTA) role.
You could also train as a teacher. Get into Teaching has more information.
Related careers
You may be interested in:
7. Current opportunities
Apprenticeships In England
Teaching Assistant Apprentice
- Weekly wage: £140
- Weekly hours: 40
- Location: Preston
Teaching Assistant Apprenticeship
- Weekly wage: £105.00
- Weekly hours: 30
- Location: Coventry
Training courses In England
Teaching Assistant L2
- Provider: Nelson and Colne College
- Start date: 01 September 2016
- Location: Manchester
Childcare Teaching Assistant L3
- Provider: Nelson and Colne College
- Start date: 01 September 2016
- Location: Diss
Last updated: 23 March 2016


Contributing
Based on https://www.conventionalcommits.org
Commit message structure
type and subject is mandatory.
scope is optional.
no dot in the end.
<type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>
Example:
feat(sample): add v3 reCAPTCHA example
Commit types
Commit message must start in a following format
- benchmark: Add benchmarks or correcting existing benchmarks
- build: Changes that affect the build system or external dependencies
- chore: Other changes that don't modify src or test files
- ci: Changes to our CI configuration files and scripts
- docs: Documentation only changes
- feat: A new feature
- fix: A bug fix
- perf: A code change that improves performance
- improvement: Improve a current implementation without adding a new feature or fixing a bug
- refactor: A code change that neither fixes a bug nor adds a feature
- revert:
reverts commit <hash>
- release: A new release
- style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
- test: Adding missing tests or correcting existing tests
Commit scopes
- Visual Studio project
- Node project name
- Angular CLI project name
- Build system(VSTS, travis, etc...)
- Documentation file(readme, changelog, etc...)
Body
Just as in the subject, use the imperative, present tense: "change" not "changed" nor "changes".
The body should include the motivation for the change and contrast this with previous behavior.
The footer should contain any information about Breaking Changes and is also the place to
reference GitHub issues that this commit Closes.


Simple, flexible python document generator
Docify helps you write documents in different formats from a Python object.
Note: It's not a document converter, neither a documentation generator, nor a document parser
pip install docify
Read API documentation on Read the Docs
Find quickstart and more examples here
Try examples like this
python doc.py markdown
python doc.py htmlbootstrap


The Doctor will be with You Shortly...
Please enter a Doctors name:
or...
Please enter a symptom:
Submit
Doctors that match your search:


This is not exactly a blog. This is a space for exploration, to improve my writing skills and my ability to articulate and communicate in the most effective way. Also, a tool for thought. And I say this for two reasons.
First, because I don't want to care about how pristine and perfect everything is; I want this to be messy, a collection of ideas, a small plant that grows and expands and lives for the sake of living instead of setting specific goals.
Second, I also say this because my first language is Spanish I was already a messy writer in Spanish. I've been writing for as long as I can recall. In the margins of my notebooks, in small books that I used to put together, on little pieces of paper that I put into jars and big containers so they don't get lost.
I never set constraints on my writing because it was such a personal, private thing.
I wrote for myself, to untangle whatever I was thinking at the moment. The structures I used for writing were either poetry, messy messy bad poetry, or academic essays. And this space is neither.
This will be a blank space. Imagine a gallery without walls, with panels that come from the ground and go up into a ceiling that is so high that you can't really see it, but you know it is there. Each one of those panels is one post, one idea that connects to the others in unexpected ways. Some are long panels, some are short panels, some are new and some are old.
Some are completely formed, while others are not. What is most important for me is not to let the fear of being perfect keep me from posting things. And then we will see together how it evolves.
For now, welcome to this place. Thank you for reading.